String storage
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | #include <stdio.h> #include <string.h> int main(void) { char arrayString[30] = "The little prince"; char* arrayStorage[10] = { NULL, }; char* pointer = strtok (arrayString, " "); unsigned short int loop = 0, temporary = 0; for (loop = 0; pointer != NULL; loop++) { arrayStorage[loop] = pointer; pointer = strtok (NULL, " "); } for (loop = 0; loop < 10; loop++) { if (arrayStorage[loop] != NULL) { printf("%s\n", arrayStorage[loop]); } } return 0; } | cs |
0 개의 댓글:
댓글 쓰기