RSS Forums RSS
Please support our C++ advertiser: Programming Forums
Views: 1794 | Replies: 8 | Thread Tools  Display Modes
Join Date: Aug 2005
Posts: 596
Reputation: SpS is on a distinguished road 
Rep Power: 5
Solved Threads: 31
SpS's Avatar
SpS SpS is offline Offline
Posting Pro

Scope Problem

  #1  
Sep 13th, 2005
Plz look at this code

#include<iostream.h>

int x=0;

int main()
{
int x=1;
{
   int x=2;
   cout<<::x;
   
cout<<x;
}
return 0;
}
<< moderator edit: added [code][/code] tags >>

does anybody know how can i access main local variable x, from inside the block, without using pointers or references?
AddThis Social Bookmark Button
Reply With Quote  

Only community members can participate in forum threads. You must register or log in to contribute.



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 3:42 am.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC