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;
Yes
NO
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
14 comments Page 1 of 2.

@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.

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.

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.

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.

Nagarjun said:   1 decade ago
In the program declaring the 2 data types.

i.e : no, *ptrono;

Then we declaring the variables for them.

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 *.

Ashok said:   4 years ago
If anyone knows what is the typedef? Please anyone explain me.
(1)

Irfan khan said:   1 decade ago
Can anybody explain about this concept ?

Suraj Mundalik said:   8 years ago
It will be like this;

long n;
long *p;

Bhagat said:   9 years ago
How is it right? Explain clearly.


Post your comments here:

Your comments will be displayed after verification.