I want to load 9 predetermined strings and 8 predetermined integers to two different arrays. I have seen code of the form:
char *namelist[] = {"Ram", "Shyam", "Dhyaan",};
int numlist[] = {0, 1, 4, 2, 5, 3, 6, 11,};
char *namelist[] = {"Ram", "Shyam", "Dhyaan",};
int numlist[] = {0, 1, 4, 2, 5, 3, 6, 11,};
To copy to clipboard, switch view to plain text mode
But I want to know some things:
- what is the * for in the first statement?
- since a string is already a character array and I need to create an array of strings, don't I need to write char *namelist[][] (two []-s)?
- is the comma necessary before the closing brace?
- is the semicolon necessary after the closing brace?
Bookmarks