Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


can we initialize all the members of union?

Answers were Sorted based on User's Feedback



can we initialize all the members of union?..

Answer / banavathvishnu

union
{
int a;
char ch;
float f;
}tt = {10};
main()
{

printf("%c",tt.ch);
}

In union it is enough to initialise one variable, same
value will reflect the value in remaning members also.

Is This Answer Correct ?    5 Yes 0 No

can we initialize all the members of union?..

Answer / vadivelt

Since Union follows the memory sharing concept, it is not
possible to initialise all union varibles at a time.

ie.,

union name
{
int a;
char b;
}c = {10, 'a'};

is not possible.

But it is possible to initialise one value at a time.

ie.,

union name
{
int a;
char b;
}c = {10};

or

union name
{
int a;
char b;
}c = {'a'};

Is This Answer Correct ?    0 Yes 3 No

Post New Answer

More C Interview Questions

Is sizeof a keyword in c?

0 Answers  


what about "char *(*(*a[])())();"

3 Answers   Oracle,


WHICH TYPE OF JOBS WE GET BY WRITING GROUPS .WHEN THE EXAMS CONDUCTED IS THIS EXAMS ARE CONDUCTED EVERY YEAR OR NOT.PLS TELL ME THE ANSWER

0 Answers  


Can u please send me the exam pattern and also Previous papers to javed123go@gmail.com

0 Answers  


Why c is a procedural language?

0 Answers  


I need to take a sentence from input and sort the words alphabetically using the C programming language. Note: This is C not C++. qsort and strtok not allowed

4 Answers   Aspire,


Is a house a mass structure?

0 Answers  


What will be the output of x++ + ++x?

20 Answers   MBT, Religare,


to get a line of text and count the number of vowels in it

3 Answers   Satyam,


Explain how can you determine the size of an allocated portion of memory?

0 Answers  


What does *p++ do? What does it point to?

0 Answers  


How do you write a program which produces its own source code as output?

0 Answers  


Categories