What is the main difference between STRUCTURE and UNION?
Answers were Sorted based on User's Feedback
Answer / shilpa
in union the size allocated is the size of the highest
member whereas in structure the size allocated is the sum of
the size of all its declerations.
| Is This Answer Correct ? | 1 Yes | 0 No |
Answer / rakesh kumar
Hi frnds...
structure and union made for different purpose....
There are no comprision between them....
frnds how can campare a car and a coconut tree....
| Is This Answer Correct ? | 4 Yes | 15 No |
Answer / anurag
At the one time only one data member can be access...or can
be used.
| Is This Answer Correct ? | 78 Yes | 101 No |
write a c program to print magic square of order n when n>3 and n is odd?
main() { char c=' ',x,convert(z); getc(c); if((c>='a') && (c<='z')) x=convert(c); printf("%c",x); } convert(z) { return z-32; }
int i=10; main() { extern int i; { int i=20; { const volatile unsigned i=30; printf("%d",i); } printf("%d",i); } printf("%d",i); }
#include<stdio.h> main() { char s[]={'a','b','c','\n','c','\0'}; char *p,*str,*str1; p=&s[3]; str=p; str1=s; printf("%d",++*p + ++*str1-32); }
why array index always strats wuth zero?
void func1(int (*a)[10]) { printf("Ok it works"); } void func2(int a[][10]) { printf("Will this work?"); } main() { int a[10][10]; func1(a); func2(a); } a. Ok it works b. Will this work? c. Ok it worksWill this work? d. None of the above
How to count a sum, when the numbers are read from stdin and stored into a structure?
#include <stdio.h> #define a 10 main() { #define a 50 printf("%d",a); }
main( ) { char *q; int j; for (j=0; j<3; j++) scanf(“%s” ,(q+j)); for (j=0; j<3; j++) printf(“%c” ,*(q+j)); for (j=0; j<3; j++) printf(“%s” ,(q+j)); }
Is the following code legal? struct a { int x; struct a *b; }
#define clrscr() 100 main() { clrscr(); printf("%d\n",clrscr()); }
Write a Program in 'C' To Insert a Unique Number Only. (Hint: Just Like a Primary Key Numbers In Database.) Please Some One Suggest Me a Better Solution for This question ??