this is a case of heap corruption On Mon, Aug 8, 2011 at 10:40 PM, Mohit Goel <mohitgoel291...@gmail.com> wrote: > #include<stdio.h> > #include<conio.h> > struct abc > { > char p[1]; > }; > int main() > { > struct abc *c =NULL; > char name[]="abcde"; > c = (struct abc *) malloc (sizeof(struct abc)); > > strcpy(c->p,name); > printf("%s",c->p); > getch(); > return 0; > } > why it is printing the whole string "abcde"..????there is not enough memory > in array 'p'... > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to algogeeks@googlegroups.com. > To unsubscribe from this group, send email to > algogeeks+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. >
-- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.