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
What are variables c?
Explain threaded binary trees?
Is there any possibility to create customized header file with c programming language?
What is a null pointer in c?
What are different types of operators?
Are pointers really faster than arrays?
show how link list can be used to repersent the following polynomial i) 5x+2
What is #error and use of it?
How can you allocate arrays or structures bigger than 64K?
Is c still relevant?
What are the different types of control structures?
can we implement multi-threads in c.
please send me the code for multiplying sparse matrix using c
What does the error 'Null Pointer Assignment' mean and what causes this error?
What is scanf () in c?