printf("%d",*power(432)) will expand as

*printf("%d", *"432")*

"432" represents here a string and *"432" is pointing to the first string
literal i.e 4 whose ascii value is 52..hence the output is 52


On Thu, Jun 23, 2011 at 4:02 PM, Shachindra A C <sachindr...@gmail.com>wrote:

>  #include<stdio.h>
> #define power(a) #a
> int main()
> {
>  printf("%d",*power(432));
>   return 0;
> }
>
> the printf statement, after preprocessing, will look like
> printf("%d",*"432");
>
> so, when u print the value at the first position of the string, 52, which
> is the ascii value of 4, will be printed.
>
> On Thu, Jun 23, 2011 at 3:40 PM, vaibhav shukla 
> <vaibhav200...@gmail.com>wrote:
>
>> #include<stdio.h>
>> #define power(a) #a
>> int main()
>> {
>>  printf("%d",*power(432));
>>   return 0;
>> }
>>
>>
>> ans is 52 on gcc. Explain plss
>>
>> --
>>   best wishes!!
>> Vaibhav Shukla
>>     DU-MCA
>>
>> --
>> 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.
>>
>
>
>
> --
> Regards,
> Shachindra A C
>
> --
> 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.
>



-- 
*Piyush Sinha*
*IIIT, Allahabad*
*+91-8792136657*
*+91-7483122727*
*https://www.facebook.com/profile.php?id=100000655377926 *

-- 
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