| | |
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 beginner binary bitmap c++ c/c++ calculator char char* class classes coding compile compiler console conversion count data database delete desktop developer directshow dll download dynamic email encryption error file forms fstream function functions game getline google graph gui homeworkhelper iamthwee ifstream input int integer java lib linkedlist linker linux 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 return rpg sorting string strings struct template templates test text text-file tree unix url vector video visualstudio win32 windows winsock word wordfrequency wxwidgets






