but it is ++(*ptr) i mean valure at ptr is incremented......n hw AN when we have written %c,,,,i cant get dat
On Sat, Oct 1, 2011 at 6:47 PM, SAMM <somnath.nit...@gmail.com> wrote: > Think pointer as an array , then u can understand the problm. > Here *ptr=TAN ; so ptr points to the First adress of the string . when > u do increment it just point to the next address and Thus is gives > "AN" . > > On 10/1/11, rahul sharma <rahul23111...@gmail.com> wrote: > > void main() > > > > { > > void *ptr; > > char *a='A'; > > char *b="TAN"; > > int i=50; > > ptr=a; > > ptr=(*char)malloc(sizeof(a)); > > printf("%c",*ptr); > > ptr=i; > > ptr=(*int)malloc(sizeof(i)); > > printf("%d",++(*ptr)); > > ptr=b; > > ptr=(*char)malloc(sizeof(b)); > > printf("%c",++(*ptr)); > > > > } > > Ans: A51AN > > > > > > int his o/p int last printf it is %c but hw it is printing a two > character > > string????AN????isn't it a51 n then ++(*ptr) ++(T) so it become *U* > > * > > * > > *isnt it a51U* > > * > > * > > * > > * > > *but above ans is correct...* > > * > > * > > *explain plz* > > > > -- > > 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. > > > > > > > -- > Somnath Singh > > -- > 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.