mscprasad wrote:
> Hi all,
>       I have one doubt in C Program. I have one code like this 
> ************************************
>           int a=20; // Global variable
>           …..
>           …..
>           int main()
>           {
>              int a; // Local Variable
>              a=10;
>              printf("Local Variable = %d \n",a); // It prints 10 Local
> Variable Value
>              printf(" global Variable Value = %d\n",a); // It should
> print Global Variable Value
>           }
> ************************************
>      I should not change the variable names. Both the global variable
> and local variable names should be same. I want to access both the
> local and global variable values inside the same function.
> 
> Thanks 
> Siva

Not possible in C.  In C++ you can do:

::a

To access a global variable of the same name.

-- 
Thomas Hruska
CubicleSoft President
Ph: 517-803-4197

*NEW* MyTaskFocus 1.1
Get on task.  Stay on task.

http://www.CubicleSoft.com/MyTaskFocus/



To unsubscribe, send a blank message to <mailto:[EMAIL PROTECTED]>. 
Yahoo! Groups Links

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

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/c-prog/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:[EMAIL PROTECTED] 
    mailto:[EMAIL PROTECTED]

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