As i mention earlier this s a literal... Wel a literal as is allotted space in the memory.. Think its heaps.. Then a reference is made to tat location in the declaration of char pointer.. You can access it but cant be altered...:-) Regards, Keybo -----Original message----- From: riti gupta Sent: 21/04/2011, 4:25 pm To: algogeeks@googlegroups.com Subject: Re: [algogeeks]
Than y r we able to do the following main() { char *p="hello"; p="bye"; } On Thu, Apr 21, 2011 at 4:21 PM, Sudhir mishra <sudhir08.mis...@gmail.com>wrote: > yes there is error; > first allocate memory for p; > > > On Thu, Apr 21, 2011 at 6:44 AM, riti gupta <ritigupt...@gmail.com> wrote: > >> is there any error in following code? >> >> main >> { >> char *p="hello"; >> p[0]='j'; >> p[1]='j'; >> puts(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. >> > > > > -- > > [image: motilal.JPG] > Thanks & Regards...* > SUDHIR MISHRA <sudhir08.mis...@gmail.com>* > *IT 3rd YEAR* > *Motilal Nehru National institute Of Technology-ALLAHABAD. > * > > -- > 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.