Okay here is one of the questions that i wanted to figure out. C does not have any array bounds checking as in Java and this can many a times lead to buffer overrun or the program space getting corrupted. I have this program
Now if i enter more than 20 chars in the arr what does it do? Does it overwrite the memory adjacent to those 20 spaces that the arr has in its possession. Also if i do so at the end of the program completion i get the message
struct name n;
struct name *np;
struct name **npp;
np = &n;
npp = &np;
printf("\n Enter your name.");
printf("\n Enter your age.");
//printf("\n Your name is %s", np->arr);
//printf("\n Your age is %d", np->age);
printf("\n Your name is %s", (*npp)->arr);
printf("\n Your age is %d", (*npp)->age);
"Stack aroudn the variable n was corrupted"
So is this an indication of the fact that i have done a buffer overrun. Also how do i implement bound checking so that these mistakes can be avoided.