what is difference between array and structure?

Answer Posted / shweta

Both arrays and structures are classified as structured data
type as provide a mechanism that enables us to access and
manipulate data in relatively easy manner. but they differ
in number of ways:-
1)An array is a collection of related data elements of same
type. Structure can have elements of different types.
2. An array is derived data type whereas a structure is a
programmer defined one.
3) An array behaves like a built in data types only we need
to declare it.but in case of structures , first we have to
design and declare a data structure before the variables of
that type are declared and used.


example:of array:

#include<stdio.h>
#include<conio.h>
void main()
{
int a[5];//only declare an array variable




example of structure:
struct book_bank
{
char title[5];
char author[3];
int pages;
float price;
};// this format of defining is also known as TEMPLATE
struct book_bank book1, book2;// declaration of variable

Is This Answer Correct ?    48 Yes 14 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what are the program that using a two dimensional array that list the odd numbers and even numbers separately in a given 10 inputs values

1470


What is meant by 'bit masking'?

1131


What is the use of getch ()?

852


What is wrong with this declaration?

849


What is non linear data structure in c?

789


Is file a keyword in c?

688


What are the header files used in c language?

805


What is the use of ?

828


Is c dynamically typed?

897


Does c have an equivalent to pascals with statement?

780


What is adt in c programming?

862


Explain the priority queues?

853


What is .obj file in c?

853


What does c mean in standard form?

870


What oops means?

759