An array is structure.It holds many number in same datatypes.we need to fixed its size first.
Array have two types

    1. One dimensional array.
    2. Two dimensional array.

Source code:
  1. #include<stdio.h>
  2. #include<conio.h>
  3. int main()
  4. {
  5. //Variable Declaration.
  6. int a[100],i,n;

  7. //Take input of max number of array.
  8. printf("give the number:");
  9. scanf("%d",&n);

  10. //Take input in array.
  11. printf("enter 1 d array digit:\n");
  12. for(i=0;i<n;i++)
  13. scanf("%d",&a[i]);

  14. //Give output in array.
  15. printf("output will be:");
  16. for(i=0;i<n;i++)
  17. printf("%d\t",a[i]);
  18. return 0;
  19. }

Output:
                Give the number:5
                Enter 1 d array digit:
                    1 2 3 4 5
                Output will be:1        2       3       4       5

3 comments: