it's near to a common mis conception that string liberals are in data
sections of THE PROGRAM


PLEASE READ THE FILE
a.out.h

and find the difference between initialized data and non initialized data

On 9/6/11, Sandy <sandy.wad...@gmail.com> wrote:
> String constants (literals) are saved into the .data section of the program,
>  Here is the sample program to show that.  if() is essentially comparing the
> addresses of two pointers which is same.
>
> int main()
> {
> char *p="persons";
> char *q="persons";
> char *r="persons";
> char *s="persons";
>  printf("%x %x %x %x\n",p,q,r,s);
> if(p=="persons")
> printf("technical %s",p);
> else
> printf("true %s",p);
> return 0;
> }
> -------------
> Output:
> 403021 403021 403021 403021
> technical persons
>
> On Tue, Sep 6, 2011 at 9:04 PM, sivaviknesh s <sivavikne...@gmail.com>wrote:
>
>>
>> main()
>> {
>> char *p="persons";
>> clrscr();
>> if(p=="persons")
>> printf("technical %s",p);
>> else
>> printf("true %s",p);
>> return 0;
>> }
>>
>> ..op : technical persons ..plz explain .. how come it works like an strcmp
>> operation???
>> --
>> Regards,
>> $iva
>>
>>  --
>> 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.
>>
>
>
>
> --
>
> *Sandeep Kumar,*
>  ( Mobile +91-9866507368
>
> *“I believe in smart work, Believe Me”*
>
> --
> 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.

Reply via email to