> #include<stdio.h>
> 
> int i=2;
>   void main()
> {
>    int i=3;
>    {
>      int i=10;
>       {
>         int  i=5;
>           {
>            printf();
>           }
>        }
>     }
> }
> 
>what can i write in printf so that the output will give the value of 
>i=3;
>       VIVEK

If it is C++ you can use scope resolution operator and print 2
by printing ::i, without scope resolution it will print 5.

If you want to print only three then  may be you can do this 

printf("%d",i=3);

It will assign value 3 to ur last defined i=5 and will print.

(i think u forgot to write int before i=10 and i=5 )

if it is C program u can access only  local variable (inner most/near most local tp 
printf , plz correct me if i ma wrong ) 

if it is C++ you can access local (inner most) variable as well as global variable 
using ::operator.

I dont think there is any other ways to access other local variable 
which have the same name as the inner most local variable.

plz correct me if i am wrong.

-Arif 








------------------------ Yahoo! Groups Sponsor --------------------~--> 
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/EbFolB/TM
--------------------------------------------------------------------~-> 

To unsubscribe : [EMAIL PROTECTED]

 
Yahoo! Groups Links

<*> To reply to this message, go to:
    http://groups.yahoo.com/group/Programmers-Town/post?act=reply&messageNum=3654
    Please do not reply to this message via email. More information here:
    http://help.yahoo.com/help/us/groups/messages/messages-23.html

<*> To visit your group on the web, go to:  
    http://groups.yahoo.com/group/Programmers-Town/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to