thanx i got it :) On Mon, Jul 4, 2011 at 2:05 PM, Sandeep Jain <sandeep6...@gmail.com> wrote:
> If you try to visualize the internal representation. > You've allocated 10 bytes. > | h | e | l | l | o | > | h | i |\0 |\0 |\0 | > > Since these are stored in linear form, so the actual representation would > be > | h | e | l | l | o | h | i |\0 |\0 |\0 | > > > Now a[0] points to 'h' in the first row, and printf starts to print > characters one by one till it finds null, i.e. \0 > Thus it prints from "hellohi" > And similarly printing a[1] prints only "hi" > > > Regards, > Sandeep Jain > > > > > On Mon, Jul 4, 2011 at 1:48 PM, Sangeeta <sangeeta15...@gmail.com> wrote: > >> #include<stdio.h> >> #include<string.h> >> void main() >> { >> char a[2][5]= { >> "hellodear", >> "hi"}; >> printf("%s%s",a[0],a[1]); >> } >> output:hellohi hi >> explain? >> >> -- >> 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. > -- 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.