SOrry guys to disturb you all... I just need a little help , can some one please give me a brief introduction to pointer...

also i have some question, what does these mean

int i;
cout<<i (mean to print i)
cout<<*i (what does it mean)
cout<<**i (what does this mean)
cout<<&i ( address of i)

Thank you.....

Also 

(int*())buffer (what does this mean).

Recommended Answers

All 3 Replies

can some one please give me a brief introduction to pointer...

A pointer is a variable that holds the address of another object. A pointer can be dereferenced to access the object stored at the address.

cout<<i (mean to print i)

i is uninitialized, but yes.

cout<<*i (what does it mean)

It means nothing. i is not a pointer, so dereferencing is not a meaningful operation.

cout<<**i (what does this mean)

It means nothing. i is not a pointer to a pointer. If one level of indirection isn't valid, two is also invalid.

cout<<&i ( address of i)

Yes.

(int*())buffer (what does this mean).

It means you don't know what you're doing. ;) At a high level it's casting the buffer object to a function taking no arguments and returning a pointer to int. But since a function type cannot be the target of a cast, the entire expression is invalid. You can cast to a pointer to a function though, assuming buffer exists and the conversion is meaningful:

int (*fp)() = (int(*)())buffer;

fp();
commented: Extremely Helpful +8

Please answer this question as well

int *p;
what does these mean?
cout<<p;
cout<<&p (Especially what it mean)
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.