can we initialize all the members of union?
Answers were Sorted based on User's Feedback
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 |
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 |
Design a program which assigns values to the array temperature. The program should then display the array with appropriate column and row headings.
while initialization of two dimensional arrays we can initialize like a[][2] but why not a[2][] is there any reason behind this?
Differentiate between #include<...> and #include '...'
What is the concatenation operator?
How are Structure passing and returning implemented by the complier?
consagous technology placement paper
how many header file is in C language ?
44 Answers College School Exams Tests, CTS, IBM, IMS, Infosys, ME, Sign Solutions, Wipro, XVT,
Write a program to compute the similarity between two strings - The program should get the two strings as input - Then it will output one single number which is the percentage of similarity between the two strings
What is the maximum no. of arguments that can be given in a command line in C.?
What is an array? What the different types of arrays in c?
How would you find a cycle in a linked list?
GIven a sequence of characters. How will you convert the lower case characters to upper case characters. ( Try using bit vector - sol given in the C lib -> typec.h)