Wrox Programmer Forums
|
Visual C++ Questions specific to Microsoft's Visual C++. For questions not specific to this Microsoft version, use the C++ Programming forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual C++ section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 30th, 2003, 06:37 AM
Registered User
 
Join Date: Aug 2003
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default pointers

If I have a memory offset of x and it read a number y, how could i change that number y into something i wanted such as z?

 
Old August 30th, 2003, 11:58 PM
Registered User
 
Join Date: Aug 2003
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Code:
#include <iostream>

int main(int argc, char * argv[])
{
 int y = 256;
 int * x = &y;
 *x = 1024;
 cout << y << endl; // prints '1024'
 return cin.get(); 
}
"The process of preparing programs for a digital computer is especially attractive, not only because it can be economically and scientifically rewarding, but also because it can be an aesthetic experience much like composing poetry or music." - Donald Knuth





Similar Threads
Thread Thread Starter Forum Replies Last Post
C/C++ Pointers reality_42000 C++ Programming 1 March 4th, 2007 01:26 AM
array and pointers amrinder C++ Programming 1 November 10th, 2006 07:58 AM
New to C++. Question about pointers jtodora Visual C++ 1 August 21st, 2003 10:28 PM
Pointers and Arrays C++ odie All Other Wrox Books 1 July 10th, 2003 01:45 PM
Pointers jake VB How-To 12 June 21st, 2003 11:30 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.