naive

what is at the end of an integer pointer to an array; as in at the end of character pointer to an array , we have '\0' ;

for e.g.
1
2
3
4
5
6
7
8
 int *num_string;char *c_string;
scanf("%s",c_string);
i=0;
while(num_string[i]!=0)
{
scanf("%d",num_string[i]);
i++;
}

after we have run the above section of codes what do we expect to have at the end of the entered elements in the integer pointer to arrray; as we have '\0' at the end of character pointer to array.......
any help would be appreciated...thanks.....
There is nothing that marks the end of an array. Not even char arrays. The reason you often find '\0' at the end of a char array is that that is the way c strings are stored.

If you want you can write a special value to the end of your array to mark the end but a better way is probably to keep track of the size of the array from when it was created.
Last edited on
We expect that the program will abort.
There is no allocated memory to store read characters.
Topic archived. No new replies allowed.