C Programming - Typedef - Discussion
Discussion Forum : Typedef - General Questions (Q.No. 1)
1.
In the following code, the P2 is Integer Pointer or Integer?
typedef int *ptr;
ptr p1, p2;
Discussion:
36 comments Page 4 of 4.
Nishant said:
1 decade ago
ptr is the pointer which has the address at which value is stored.And p2 is defined as ptr so p2 is the integer pointer which has the address at which has integer value...
Vengatraman said:
1 decade ago
Becoz p1, p2 s assigned as ptr var & ptr is defined as integer. So I think as it is integer pointer.
Jigar said:
1 decade ago
@lordy
but ptr is integer type pointer so i think indirectly p1 is also integer
but ptr is integer type pointer so i think indirectly p1 is also integer
Lordy said:
1 decade ago
@sunil
p1 is just a pointer. it is not declared as int so how can that be integer. think u will understand clearly.
p1 is just a pointer. it is not declared as int so how can that be integer. think u will understand clearly.
Sunil said:
1 decade ago
Then whether p1 is an integer. Please answer any one with explanation.
Kumaran said:
1 decade ago
Here we declared ptr as a pointer variable. Using that we can assign two pointers. First one hold the address of Ptr variable. And second one points the address of the first variable. Here the declaration is correct. And p1, p2 are not integers. So B is the answer.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers