I am trying to understand the concept of array of char pointers in C. In this basic example I try to get the number of strings using the x++ operator but, unfortunately I get a compiler error because maybe I try to access an extra region of memory but I shoudn't? Thanks for any help.
#include <stdio.h>
int main()
{
char *argv[]= {"hello","world"};
int num = 0;
while (argv[num++] != NULL){
printf("num value: %i\t %c\n",num,*argv[num-1]);
}
printf("Final num value: %i\n",num);
return 0;
}
Cygwin Exception : open stack dump file.