difference between structure and union.
Answers were Sorted based on User's Feedback
Regarding the struct, each item in the struct is allocated
in a separated memory. And the size of a struct object is
total size of all its items.
But with the union, all its items are in the same memory.
And the size of an union object is size of its item which
has largest size.
| Is This Answer Correct ? | 24 Yes | 0 No |
Answer / siva sankari
struct employee
{
int a[20];// for tis size 20 was allocated in memory
char text;// for tis only 1byte of memory space is allocated
}
so totally 21 in size was allocated in memory space
union employee
{
int a[20];// for tis size 20 was allocated in memory
char text;// for tis only 1byte of memory space is allocated
}
but in union it takes only the maximum memory space so for each 20space totally 40 size was allocated in memory space
| Is This Answer Correct ? | 7 Yes | 12 No |
What is object-oriented programming? Webopedia definition
inheritence with example
This program numbers the lines found in a text file. Write a program that reads text from a file and outputs each line preceded by a line number. Print the line number right-adjusted in a field of 3 spaces. Follow the line number with a colon, then one space, then the text of the line. You should get a character at a time and write code to ignore leading blanks on each line. You may assume that the lines are short enough to fit within a line on the screen. Otherwise, allow default printer or screen output behavior if the line is too long (i.e., wrap or truncate). A somewhat harder version determines the number of spaces needed in the field for the line numbers by counting lines before processing the lines of the file. This version of the program should insert a new line after the last complete word that will fit within a 72-character line.
What is multidimensional array?
to remove the repeated numbers from the given . i.e.., if the input is 12233 output should of 123
WILL I GET A guaranteed JOB AFTER DOING bsc()IT) and GNIIT from an NIIT CENTRE??
21 Answers Biocon, MIT, NIIT,
Can we have a private constructor ?
12 Answers HSBC, Ness Technologies, TCS, Wipro,
What are the valid types of data that the main () can return in C/C++ language
What does the code "cout<<(0==0);" print? 1) 0 2) 1 3) Compiler error: Lvalue required
What is the difference between procedural programming and oops?
Give two or more real cenario of virtual function and vertual object
What does no cap mean?