| | |
Need help figuring out C++ Pointers
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
Behavior is undefined since ptr2 does not point anywhere.
"One of the methods used by statists to destroy capitalism consists in establishing controls that tie a given industry hand and foot, making it unable to solve its problems, then declaring that freedom has failed and stronger controls are necessary." --Ayn Rand
Did you try compiling it and running it?
•
•
•
•
s s
"One of the methods used by statists to destroy capitalism consists in establishing controls that tie a given industry hand and foot, making it unable to solve its problems, then declaring that freedom has failed and stronger controls are necessary." --Ayn Rand
•
•
•
•
Originally Posted by hail2dthief
The code you given has some error, are you sure you are giving the right code?
Anyway, the output should be:
x x
cause ptr1 has been assigned to the address of var2. When you output the value of *ptr1, it will refer to the value of that address.
•
•
•
•
Originally Posted by hfick
i need to know the data types of variables such as:
double var1, *ptr1, *ptr2;
float *ptr3;
int var2, *var4....do you know anything about data types?
"One of the methods used by statists to destroy capitalism consists in establishing controls that tie a given industry hand and foot, making it unable to solve its problems, then declaring that freedom has failed and stronger controls are necessary." --Ayn Rand
var1 is a double
ptr1 is a pointer to double
...you should be able to handle it from here.
ptr1 is a pointer to double
...you should be able to handle it from here.
"One of the methods used by statists to destroy capitalism consists in establishing controls that tie a given industry hand and foot, making it unable to solve its problems, then declaring that freedom has failed and stronger controls are necessary." --Ayn Rand
![]() |
Other Threads in the C++ Forum
- Previous Thread: Error in c++ program
- Next Thread: database access using c++
| Thread Tools | Search this Thread |
api array based beginner binary bitmap c++ c/c++ calculator char char* class code coding compile compiler console conversion count database delete deploy developer directshow dll download dynamic dynamiccharacterarray email encryption error file forms fstream function functions game givemetehcodez google graph gui homeworkhelp homeworkhelper iamthwee ifstream input int java lib linkedlist linker list loop looping loops map math matrix memory multiple news node number numbertoword output parameter pointer problem program programming project proxy python random read recursion recursive reference rpg sorting string strings temperature template test text text-file tree unix url variable vector video visualstudio win32 windows winsock word wordfrequency wxwidgets






