Ans:-
Differences between array and struct are given below.
Differences between array and struct are given below.
Array | struct |
---|---|
1.It stores same type of data | 1. It stores dis-similar type of data. |
2.It uses static memory allocation . | 2.I uses dynamic memory allocation. |
3.It takes less time to access elements. | 3.It takes more time to access elements. |
4.It uses index value to access elements. | 4.It takes help of period operator(.) to access elements. |
5.It is derived data type. | 5. IT is user's defined data type. |
6.We can not define array of array. | 6.We can define array of structure. |
7.Its syntax is data type identifier[value]; example,int a[20]; | 7.Its syntax is struct tag {datatype member1; datatype member2; data type member3; }variable; example, struct det {char name[100]; char add[40]; int roll; }variable; |
No comments:
Post a Comment