hello, i am currently trying to accommodate myself with the c language. i have been trying to learn by reading "C: The Programming Language" by Kernighan and Ritchie (typically referred to as the "White Bible"). I have been trying to write-up some code of my own that consists of the following:
main(){
int i;
i = 0;
char sarray [17];
sarray = "This is a string!";
while (i != '\0')
printf("sarray");
printf("\n");
}
however, whenever i try to run gcc (I have been doing all of my coding on an Ubuntu machine), I am given errors with this line:
sarray = "This is a string!";
what is the problem? The error message states:
incompatible types when assigning to type ‘char[17]’ from type ‘char *’
how do I resolve this issue? Any help would be greatly appreciated!
main(){
int i;
i = 0;
char sarray [17];
sarray = "This is a string!";
while (i != '\0')
printf("sarray");
printf("\n");
}
however, whenever i try to run gcc (I have been doing all of my coding on an Ubuntu machine), I am given errors with this line:
sarray = "This is a string!";
what is the problem? The error message states:
incompatible types when assigning to type ‘char[17]’ from type ‘char *’
how do I resolve this issue? Any help would be greatly appreciated!