Hi, I am getting into pointer and linked lists now!
Here is my question,
If I am reading this chapter right, this just allocates memory it does not initialize memory, am I right???Code:int *x; int *y = new int;
Thanks!!!
Hi, I am getting into pointer and linked lists now!
Here is my question,
If I am reading this chapter right, this just allocates memory it does not initialize memory, am I right???Code:int *x; int *y = new int;
Thanks!!!
yea thats right... the memory you allocated might hold some junk value..
>am I right???
You are indeed. Or to be more precise, x is uninitialized and points to nothing usable and y points to enough memory for an integer.
My best code is written with the delete key.
>"char" by default is signed, right?
No, char could be either signed or unsigned by default.
My best code is written with the delete key.
> "char" by default is signed, right?
You don't listen very well do you?
http://cboard.cprogramming.com/showt...igned+unsigned
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
>You don't listen very well do you?
No, I just think he fills his brain up with all kinds of trivia and then forgets.
My best code is written with the delete key.
I'd be surprised if he's written a single program yet, I think he's skipping that part and going straight to the "I'm gonna write a programming encyclopedia" part. No offense C++Forever.
[email protected]
Microsoft Visual Studio .NET 2003 Enterprise Architect
Windows XP Pro
Code Tags
Programming FAQ
Tutorials
>I think he's skipping that part and going straight to the "I'm gonna write a programming encyclopedia" part.
He's doing such a good job of picking my brain it's either that or he's testing us here at Cprogramming to see what we know.
My best code is written with the delete key.