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.
Amit Saxena said:
9 years ago
@All.
I think we should try the given codes in c compiler provided.
@Pankaj.
I tried your code and definitely p1 and p2 are working as an integer, not as integer pointers.
I think we should try the given codes in c compiler provided.
@Pankaj.
I tried your code and definitely p1 and p2 are working as an integer, not as integer pointers.
(2)
Prasanth said:
8 years ago
Can we say like this?
*ptr is the name used instead of int and
ptr defines the variables as p1 and p2.
but how to compare the both *ptr and ptr.
*ptr is the name used instead of int and
ptr defines the variables as p1 and p2.
but how to compare the both *ptr and ptr.
Ruhi said:
6 years ago
How is it possible?
Whenever we use typedef, that means we are renaming the previously defined keyword or variable.
If we have declared,
Typedef int *ptr;
That means simply we have renamed, int as *ptr. Then how did it become a pointer?
Please answer me with a clear explanation.
Whenever we use typedef, that means we are renaming the previously defined keyword or variable.
If we have declared,
Typedef int *ptr;
That means simply we have renamed, int as *ptr. Then how did it become a pointer?
Please answer me with a clear explanation.
(1)
Jethalal said:
5 years ago
@Ruhi, Yes I also have the same doubt.
Akash said:
5 years ago
@Parin.
Your explanation is very clear, Thanks.
Your explanation is very clear, Thanks.
Akash said:
5 years ago
@Ruhi.
It will change the name of int* as ptr.
It will change the name of int* as ptr.
(1)
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers