C Programming - Typedef - Discussion
Discussion Forum : Typedef - Yes / No Questions (Q.No. 1)
1.
Is the following declaration acceptable?
typedef long no, *ptrtono;
no n;
ptrtono p;
Discussion:
14 comments Page 1 of 2.
Ashok said:
4 years ago
If anyone knows what is the typedef? Please anyone explain me.
(1)
Siddhartha soam said:
5 years ago
Here, ptrtono is declared as a pointer
but in third line(ptrtono p;) is wrong because, we have to use & operator to store a pointer value.
So the correct form is(ptrtono &p;).
Correct me if I am wrong.
but in third line(ptrtono p;) is wrong because, we have to use & operator to store a pointer value.
So the correct form is(ptrtono &p;).
Correct me if I am wrong.
Yash said:
8 years ago
Yes, right @Sanju.
Suraj Mundalik said:
8 years ago
It will be like this;
long n;
long *p;
long n;
long *p;
Bhagat said:
9 years ago
How is it right? Explain clearly.
Aksshat said:
10 years ago
Can any one explain?
Venkatesh said:
1 decade ago
I am not sure of this but typedef long *ptr; <=> typedef(long*)ptr; here we are declaring ptr as as a long pointer.
Now typedef long no. is using no to replace long.
Now typedef long no. is using no to replace long.
Sanju said:
1 decade ago
We are using no as long ptrtono as long pointer like long *.
So no as long and prttono as long *.
So no as long and prttono as long *.
@brij said:
1 decade ago
Declaration of typedef as declaration integer i.e.
int a,*b;
Similarly typedef can also be declare typedef no,*prtono
Here two variable declared i.e no which only data type and prtono that is pointer type variable.
int a,*b;
Similarly typedef can also be declare typedef no,*prtono
Here two variable declared i.e no which only data type and prtono that is pointer type variable.
Rohit said:
1 decade ago
We are giving two different names to long i.e no and *prtono.
Either of these can be used to declare long variable.
Either of these can be used to declare long variable.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers