I'm teaching myself C from a book and I am trying to create a crossword puzzle. I need to make an array of strings but keep running into problems. Also, I don't know much about array...
This is the piece of the code:
char word1 [6] ="fluffy", word2[5]="small",word3[5]="bunny";
char words_array[3]; /*This is my array*/
char *first_slot = &words_array[0]; /*I've made a pointer to the first slot of words*/
words_array[0]=word1; /*(line 20)Trying to put the word 'fluffy' into the fist slot of the array*/
But I keep getting the message:
crossword.c:20:16: warning: assignment makes integer from pointer without a cast [enabled by default]
Not sure what is the problem...I have tried to look up how to make an array of strings but with no luck
Any help will be much appreciated,
Sam
char word1 [6] ="fluffy"- "fluffy" is actually 7 characters. In C, a string is terminated with a\0- which takes up one extra character.const char* arr[] = { "literal", "string", "pointer", "array"};, and note the const.&words[0]Er...you don't seem to have a variablewordsat that point. Did you make an error copying your code or leave out something?