I want to print out all elements from the array to debug my program.
Here is the for loop to print out all elements of the array
for(int i = 0; i <= 9; i++) {
printf("Words: %s\n", &words[i]);
}
I have a header file that contains the const char
array. This is required for a task.
I know that its probably not good practice to put them in header files.
const char *words[10] = {'foo', 'bar', 'hello', 'world'};
My output when I run this code is very weird as it prints everything backwards.
Keywords: oof
Keywords: rab
Keywords: olleh
Keywords: dlrow
Sometimes, it would even add random full stops at the end of each keyword. Why is this? I have not written anything else but that.