Follow Our FB Page << >> for Daily Laughter. We Post Funny, Viral, Comedy Videos, Memes, Vines...

what is difference between array,strutter,union and pointers

Answers were Sorted based on User's Feedback

what is difference between array,strutter,union and pointers..

Answer / shashidhar

array can contain single data type
Structure is collection of different data types
Unions can also contain different data types, but here the
different date types share the same memory within the
computers memory

|| ||

in the above the memory between || || is shared by int,
float, double declarations in a UNION.
where as in struture || || || the memory
declared for int and float and double are different.
which implies memory utilization is better in union.

When you come to pointers, well it can point to a data type
(like int) can point to a structure (struct xyz{ };) , it
can point to a union (union item { }; ) so its like a honey
BEE it can sit on anything

Is This Answer Correct ?    54 Yes 9 No

what is difference between array,strutter,union and pointers..

Answer / ravi

structure is collection of different data types.
union is same as the structures, the only difference is in
memory allocation.
int a;
float b;
struct s;

For the above structure it allocates 2bytes for integer
variable and 4 bytes for flaot variable. so totally it
allocates 6bytes of memory to that structure. we can print
the s.a and s.b values as 10 and 3.0
int a;
char ch;


But incase of union, the memory allocated is maximum
memory required among the variables. so only 4 bytes is
allocated to unions.
if u try to print the u.a, values it prints 97, 97
where the value of u.a is being assigned by . so we
cannt get value of u.a at last. It wont happen incase of
structures. so mostly we use structures in programming.

Is This Answer Correct ?    31 Yes 6 No

what is difference between array,strutter,union and pointers..

Answer / dfg


Is This Answer Correct ?    11 Yes 14 No

Post New Answer

More C Interview Questions

write a “Hello World” program in “c” without using a semicolon?

9 Answers   CTS, TCS, Wipro,

An arrangement of information in memory in such a way that it can be easily accessed and processed by a programming language a) string b) data structure c) pointers d) array

0 Answers  

Using which language Test cases are added in .ptu file of RTRT unit testing???

0 Answers  

out put of printf(“%d”,printf(ram));

5 Answers  

cavium networks written test pattern ..

0 Answers   Cavium Networks,

A float occupies 4 bytes in memory. How many bits are used to store exponent part? since we can have up to 38 number for exponent so 2 ki power 6 6, 6 bits will be used. If 6 bits are used why do not we have up to 64 numbers in exponent?

0 Answers  

what is the return value (status code) of exit() function.... what the arguments(integer value) passed to it means....

1 Answers   TCS,

What was noalias and what ever happened to it?

0 Answers  

Explain the use of bit fieild.

0 Answers  

what is difference between array of characters and string

18 Answers   Accenture, Nest,

Study the code: void show() main() { show(); } void show (char *s) { printf("%sn",s); } What will happen if it is compiled & run on an ANSI C Compiler? A)It will compile & nothing will be printed when it is executed B)it will compile but not link C)the compiler will generate an error D)the compiler will generate a warning

4 Answers   Accenture,

what is the difference between const volatile int i & volatile const int j;

2 Answers   HCL,