J
Jigar Mehta
Hye all,
I have noted while debugging my program (or also in runtime
execution) that sometimes (not regularly) char * pointer gets
overwritten and looses its value...
So, because of this my couple of products have failed and this is the
reason I have made it compulsary to use char [] instead of char *
because char[] don't overwrite our data...
So, anybody from you can please make me understand why this happens ??
suppose my code is,
char *name;
strcpy(name, "Jigar Mehta");
..
..
..
..
//After some lines of execution (say 50 lines) if I see what's there in
name address, it gets overwritten and value becomes "" instead of
"Jigar Mehta"...
I have noted while debugging my program (or also in runtime
execution) that sometimes (not regularly) char * pointer gets
overwritten and looses its value...
So, because of this my couple of products have failed and this is the
reason I have made it compulsary to use char [] instead of char *
because char[] don't overwrite our data...
So, anybody from you can please make me understand why this happens ??
suppose my code is,
char *name;
strcpy(name, "Jigar Mehta");
..
..
..
..
//After some lines of execution (say 50 lines) if I see what's there in
name address, it gets overwritten and value becomes "" instead of
"Jigar Mehta"...