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;
Integer
Integer pointer
Error in declaration
None of above
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
36 comments Page 3 of 4.

Divya said:   1 decade ago
typedef int (*ptr) ;
ptr p1, p2;

What happens in this case ? what will be the type of ptr then ?

Anis gupta said:   1 decade ago
Hi, typedef act as syntax replacement so simply.

ptr replace with int *,
So it is int *p1,p2;

Jigar said:   1 decade ago
@lordy

but ptr is integer type pointer so i think indirectly p1 is also integer

Lakshmi prasanna said:   1 decade ago
ptr is an integer pointer. Hence both the variables store the pointers.

Sunil said:   1 decade ago
Then whether p1 is an integer. Please answer any one with explanation.

Manju said:   1 decade ago
ptr is an pointer variable, so the variable stored in pointer only.

Lakshminaik said:   1 decade ago
Any body help me how to create a struct function how may types.

Ramya said:   1 decade ago
@Teju your explanation is very nice and thank you so much.

Akash said:   5 years ago
@Parin.

Your explanation is very clear, Thanks.

Akash said:   5 years ago
@Ruhi.

It will change the name of int* as ptr.
(1)


Post your comments here:

Your comments will be displayed after verification.