LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   array of unions in c (https://www.linuxquestions.org/questions/programming-9/array-of-unions-in-c-364764/)

alaios 09-19-2005 02:16 AM

array of unions in c
 
Hi lets suppose that we declare an array of unions'

union{
long lala;
int myint;
char mychar[30];
}myunion[40];

Is is possible to do the following
myunion[1].lala=323434243;
strcpy(myunion[2].char,"shit);
and so on?

jlliagre 09-19-2005 03:07 AM

Just try it, that's the best way to learn.

alaios 09-19-2005 03:48 AM

i have tried it and i think it works but still i am not sure

addy86 09-19-2005 09:02 AM

You have 1200 posts, probably most of them programming-related, but still don't know the basics about arrays and unions? And even more, it works, but you're not sure whether it works?

I hope I didn't hurt you...


All times are GMT -5. The time now is 08:16 PM.