+ 1

Can we use typedef for union also?

24th Nov 2018, 3:25 PM
ARPIT SODANI
ARPIT SODANI - avatar
2 Respuestas
+ 5
Yes. typedef union{ int a; float b; } myUnion; myUnion u;
24th Nov 2018, 3:29 PM
Dennis
Dennis - avatar
+ 1
yes here is the example #include<stdio.h> typedef union myunion { double PI; int B; }MYUNION; int main() { MYUNION numbers; numbers.PI = 3.14; numbers.B = 50; return 0; }
24th Nov 2018, 3:44 PM
Abinaya sekar