how i create pointers?
can you give me an example plz?
how i create pointers?
can you give me an example plz?
Well since your question is pretty general, my answer will be:
//to create a regular int variable
int i;
//to create a pointer to an int variable
int *i;
Notice the *. That's what tells you it's a pointer.
//using static memory
int * intPtr = '\0';
int num = 8;
intPtr = #
cout << *intPtr;
//using dynamic memory
int * iPtr = new int;
*iPtr = 5;
cout << *iPtr;
Notice that the * operator means pointer when used in declaration and as derefernce operator when used outside of
declaration and as multiplication operator under other circumstances.