Re: [Dev-C++] Question about pointers (beginner)
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: <a_g...@ya...> - 2003-05-27 22:37:47
|
Mention not friend, it happens to everybody sometimes :-).
OROSZI_Balázs <or...@vp...> wrote:Avik Ghose wrote:
> I think still x will be 456. Lets look at it this way.
> x=123.
> p=&x
> now *p implies the content of the address pointed to by p which is
> nothing but the memory symbolised by the name 'x'.
> hence when *p=456 is set, after that.
> x will also be equal to 456
WAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA!!!!
ME FOOOOOOOOOOOOL!!!
It is a serious TYPO!!!!
I thought 456, and I wrote 123!
Stupid, fool, idiot...
I'll correct it:
If I implemented this, this is how I would do it:
#include
main()
{
int x, *ptr_int;
x = 123; /* Given x = 123 */
ptr_int = &x; /* and ptr_int =&x */
*ptr_int = 456; /* after that *ptr_int = 456 has been executed */
printf("%d",x); /* What is the value of x? */
/* ***CORRECTED***: THE ANSWER IS: 456 */
}
Sorry, and thanks.
It was a typo. My brain sometimes is out %)
--
Greetings,
Balázs
-------------------------------------------------------
This SF.net email is sponsored by: ObjectStore.
If flattening out C++ or Java code to make your application fit in a
relational database is painful, don't do it! Check out ObjectStore.
Now part of Progress Software. http://www.objectstore.net/sourceforge
_______________________________________________
Dev-cpp-users mailing list
Dev...@li...
TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm
https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
Thanx and Regards
Avik Ghose
Catch all the cricket action. Download Yahoo! Score tracker |