0

What is typedef and how to use it

typedef in structure

24th Aug 2018, 7:18 PM
Shruti Nayak
5 Answers
0
Shruti Nayak you can declare something which is not datatype in c++ as datatype... refer below : typedef int nit; // now nit behaves as datatype like int nit a = 55; // see wee declared a as of nit cout << a; follow same concept for structure and feel free to ask for any query
25th Aug 2018, 2:30 AM
Ketan Lalcheta
Ketan Lalcheta - avatar
0
Ketan Lalcheta then how many bytes nit acquire memory
26th Aug 2018, 10:10 AM
Shruti Nayak
0
it behaves like int... so nit memory also depends upon compiler type....
26th Aug 2018, 10:18 AM
Ketan Lalcheta
Ketan Lalcheta - avatar
0
is typedef is used only in structure in c language
27th Aug 2018, 4:16 PM
Shruti Nayak
0
Shruti Nayak no..it's not limited to structure..in above example, we have used it for int
27th Aug 2018, 5:39 PM
Ketan Lalcheta
Ketan Lalcheta - avatar