"Ya!Hello! how is this? %s\n"
is essentially a character array
3["Ya!Hello! how is this? %s\n"] yields H.
&3["Ya!Hello! how is this? %s\n"] yields address of character array
beginning with H i.e address of array "Hello! how is this? %s\n" which forms
the format string in printf.

Thus Hello! how is this gets printed and then printf looks for a string in
its arguments.
&b["junk/super"] yields super...which gets printed due to %s in format
string.

Similar arguments apply to second case



On Thu, Jun 2, 2011 at 11:45 PM, shashankreddy509 <
shashankreddy...@gmail.com> wrote:

> Can any one explain the output of this...
>
> i have a guess.
>
> int a=3, b = 5;    printf(&a["Ya!Hello! how is this? %s\n"],
> &b["junk/super"]);
>
> here a is 3 so it print the after 3 characters  ie."*Hello! how is this?*
> ".
> and coming to b is 5 so it prints "*super*".
>
> this is my guess and i cant get the other part this.
>
> so can any one tell the correct answer..
>
> thanks.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/algogeeks/-/clNhSWJBaEJEZllK.
>
> 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
Pritpal Singh Banga
(RIT2008021)
BTech ( IT ) , 6th Semester,
Indian Institute of Information Technology
Allahabad - 211012, India
Official email : rit2008...@iiita.ac.in <rit2008...@iiita.ac.in>
Mobile: +91-9793907703

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