Hello,
why does the function below print the second element "Jim" rather than the first "Hanna"?
I am correct by using a 2d array for a static list of names?Code:#define PERSONS_NUM 4
char Names[PERSONS_NUM][40] = {
"Hanna",
"Jim",
"Gregory",
"Will"
};
void PrintString(char* c)
{
while (*c) {
putchar(*c);
c++;
}
}
int main(void)
{
PrintString(&Names[0][40]);
}