I am just starting out with C and I am trying to make an array of 3 strings pass through a function. However, in that function, only 1 string remains and it looks like there isn't even an array. I have tried numerous things already but I can't seem to fix it.
#include <stdio.h>
#define NUM_WORDS 3
#define MAX_WORD_SIZE 64
void printStrings(char words[])
{
//But now 'words' looks like this: "one"
for (int i = 0; i < NUM_WORDS; ++i)
printf("%s", words[i]);
}
void main()
{
char words[NUM_WORDS][MAX_WORD_SIZE] = { "one", "two", "three" };
//At this point the array 'words' looks like this:
//{ "one", "two", "three" }
printStrings(words);
}