| 17 | printf("%d ",arr.A[i]); // it will display all the elements |
| 18 | } |
| 19 | int main() |
| 20 | { |
| 21 | struct Array arr; |
| 22 | int n; // how many no is going to be inserted |
| 23 | int i; |
| 24 | printf("Enter size of an array "); |
| 25 | scanf_s("%d", &arr.size); |
| 26 | arr.A = (int*)malloc(arr.size * sizeof(int)); // dynamically created array |
| 27 | arr.length = 0;// intially no elements |
| 28 | printf("Enter number of numbers "); |
| 29 | scanf_s("%d", &n); |
| 30 | printf("Enter All the elements "); |
| 31 | for (i = 0; i < n; i++) |
| 32 | scanf_s("%d", &arr.A[i]); // enter the elements of an array |
| 33 | arr.length = n; // set length as n |
| 34 | |
| 35 | |
| 36 | Display(arr); |
| 37 | |
| 38 | |
| 39 | return 0; |
| 40 | } |