|
Arrays in C++
An Introduction |
|
Prof. David Bernstein |
| Computer Science Department |
| bernstdh@jmu.edu |
int scores[10];
x = scores[3];
NUL character (i.e., '\0')
char course[6]; course = "CS240\0"; // Invalid
strcpy() can't know the size of the array
so just copys whatever you tell it to, even if there isn't
enough memorystrncpy() which doesn't null-terminate if there
isn't spacestrncat() which doesint scores[30][5];
scores[0][3] = 100;
strcpy()
in the above example is strcpy(courses[1], "GISAT200");?