Well As we know for copying the string we can can copy it as a simple variable as in case of address copying. when u r doing names[3] = names[4] , it means u r trying to copy it directly bt in the case of char *names[] , as it is the array of pointers so u can copy the address from one pointer to another pointer....
Thanks On Sat, Jun 12, 2010 at 9:12 PM, divya <sweetdivya....@gmail.com> wrote: > #include<stdio.h> > > int main() > { char names[][20]={ > "roshni", > "manish", > "sona", > "baiju", > "ritu" > }; > int i; > char *t; > t=names[3]; > names[3]=names[4]; > names[4]=t; > for(i=0;i<=4;i++) > printf("%s",names[i]); > printf("\n"); > return 0; > } > > here i get l value required as error and if i replace char names[][2] > with char *names[].. then there is no error nd the names[3] n names[4] > interchange > plzzzz explain why??? > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to algoge...@googlegroups.com. > To unsubscribe from this group, send email to > algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > > -- Mahesh Giri MCA Final Sem JNU, New Delhi -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algoge...@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.