#a is the replacement sequence which is substituted in the printf statement
The statements
#define power(a) #a
printf("%d",power(a));
is substituted as
printf("%d","a");
it is replaced with the string literal "a" . then *power(a) is converted as
value at that string literal address.
Hope this solves the problem :)
------------------------------------------------------
Rajeev N B
I Blog @ www.opensourcemania.co.cc
On Thu, Jun 23, 2011 at 3:40 PM, vaibhav shukla <[email protected]>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 [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.