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.
Divya said:
1 decade ago
typedef int (*ptr) ;
ptr p1, p2;
What happens in this case ? what will be the type of ptr then ?
ptr p1, p2;
What happens in this case ? what will be the type of ptr then ?
Sai said:
1 decade ago
Excellent martin. Good observation.
Avnish said:
1 decade ago
We defined value at ptr(*ptr) as integer. So p1 and p2 not storing the adress their is they are storing value.
#include<stdio.h>
int main()
{
typedef int *ptr;
ptr p1, p2;
printf("%d %d",p1,p2);
}
#include<stdio.h>
int main()
{
typedef int *ptr;
ptr p1, p2;
printf("%d %d",p1,p2);
}
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.
Aravind said:
1 decade ago
What reason we can use typedef ?
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers