hey...d code doesn't compile on gcc though

On Sat, Oct 1, 2011 at 7:32 PM, rahul sharma <[email protected]>wrote:

> 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 <[email protected]> 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 <[email protected]> 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 [email protected].
>> > To unsubscribe from this group, send email to
>> > [email protected].
>> > 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 [email protected].
>> To unsubscribe from this group, send email to
>> [email protected].
>> 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 [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> 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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to