what is difference between array and structure?
Answer Posted / vinay
Array -
* Memory (array size) is fixed
* Accessing an element in array takes constant time. E.g. -
5th element in an array can be accessed as array[4] i.e.
searching/accessing an element in array takes comparatively
less time than in structures.
* Adding/deleting an element in the array is comparatively
difficult since the data already present in the array needs
to be moved
Structure -
* Memory (structure size) can be changed dynamically
* Accessing an element in a list takes more time
comparatively since we need to traverse thro the list
* Adding/deleting takes less time than in arrays
Is This Answer Correct ? | 208 Yes | 28 No |
Post New Answer View All Answers
What is a stream?
What is null pointer in c?
When the macros gets expanded?
What are register variables? What are the advantage of using register variables?
what is the difference between class and unio?
What is scope of variable in c?
What will the preprocessor do for a program?
What are the 5 elements of structure?
Write a program that takes a 5 digit number and calculates 2 power that number and prints it(should not use big integers and exponential functions)
How can I generate floating-point random numbers?
Q.1 write a program to create binary tree 1 to 16 numbers? Q.2 write a program to creat a binary search tree for the member that is given by user?
How important is structure in life?
Explain what is operator promotion?
What is wrong in this statement?
What are enums in c?