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


Please Help Members By Posting Answers For Below Questions

which is an algorithm for sorting in a growing Lexicographic order

1383


How can I find the modification date and time of a file?

594


Who developed c language and when?

571


Why isn't any of this standardized in c? Any real program has to do some of these things.

615


What is the difference between pure virtual function and virtual function?

641






How are structure passing and returning implemented?

583


a character or group of characters that defines a register,or a part of storage a) memory b) byte c) address d) linear list

617


Do variables need to be initialized?

614


Explain what is meant by high-order and low-order bytes?

625


Explain a pre-processor and its advantages.

610


Why should I use standard library functions instead of writing my own?

663


When should a far pointer be used?

589


What are valid signatures for the Main function?

694


What is c variable?

540


What is a macro?

647