I want to clear some concepts
1- A pointer can only store an address , pointer itself can not store data like any other variable can. right? (as the below code doesn't run)
int *myptr;
*myptr=20;
cout<<(*myptr);
2- if you create a pointer of a class say FOO
class foo
{
public:
int numb1 ;
char alphabet;
}
// this doesn't run
void main()
{
foo *myptr ;
cout<< myptr->numb1;
}
so my question is that would the pointer of class foo (*myptr) have variables numb1 and alphabet ? if not then what's the difference between a foo pointer and a int pointer (apart from that each pointer can only point to it's respective data type)