c pointer array #118829
-
Select Topic AreaQuestion Body`#include <stdio.h>
} |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 2 replies
-
Thanks for posting in the GitHub Community, @zidudu! We're happy you're here. You are more likely to get a useful response if you are posting your question in the applicable category, the Feed category is solely related to conversations around the GitHub product Feed. This question should be in the Programming Help category. I've gone ahead and moved it for you. Good luck! |
Beta Was this translation helpful? Give feedback.
-
There is a syntax error when you initialize the string array. Array elements don't need {}, so the right initialization is: |
Beta Was this translation helpful? Give feedback.
-
Also, why is there a * before ptrArray[4]? In C, Arrays already are pointers, so you should remove it. |
Beta Was this translation helpful? Give feedback.
-
Hello, @zidudu! The code you provided doesn't compile because you use your ptrArray incorrectly. Here's your full code corected
Have a great day! |
Beta Was this translation helpful? Give feedback.
Hello, @zidudu!
The code you provided doesn't compile because you use your ptrArray incorrectly.
Instead of using
char *ptrArray[4] = { {"Korea"},{"Seoul"},{"Mapo"},{"Gimpo"} };
You should put elements inside without curly braces, like:
char *ptrArray[4] = {"Korea", "Seoul", "Mapo", "Gimpo"};
Here's your full code corected
Have a great day!