![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Strange sed behaviour | vino | UNIX for Advanced & Expert Users | 8 | 02-12-2008 06:51 AM |
| A Strange Behaviour!!! | navojit dutta | Shell Programming and Scripting | 5 | 12-21-2007 04:35 AM |
| Different behaviour of this program | royalibrahim | High Level Programming | 7 | 10-20-2007 07:07 PM |
| Count behaviour when using su - | Eronysis | Shell Programming and Scripting | 1 | 02-20-2006 06:20 PM |
| Behaviour of default | soorajmu | High Level Programming | 5 | 12-09-2003 12:43 PM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Can some 1 explain why this behaviour
#include <iostream>
using namespace std; int main() { const int l_test = 999999999; int *l_ptr = (int*) &l_test; cout<<"Constant Addr:"<<&l_test<<" Value:"<<l_test<<endl; cout<<"Pointer Addr:"<<l_ptr<<" Value:"<<*l_ptr<<endl; *l_ptr = 888888888; // Manipulating the pointer cout<<"-------------------------------"<<endl; cout<<"Constant Addr:"<<&l_test<<" Value:"<<l_test<<endl; cout<<"Pointer Addr:"<<l_ptr<<" Value:"<<*l_ptr<<endl; return 0; } The o/p for this program is Constant Addr:0012FF7C Value:999999999 Pointer Addr:0012FF7C Value:999999999 ------------------------------- Constant Addr:0012FF7C Value:999999999 Pointer Addr:0012FF7C Value:888888888 please look into the last 2 lines, the question is : how can same address 0012FF7C have 2 different values 888888888 & 999999999 Thanks , ![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|