1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

what should be the output?

Discussion in 'C' started by Ankur Kamboj, Aug 2, 2011.

  1. Ankur Kamboj

    Ankur Kamboj New Member

    Joined:
    Jun 19, 2011
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    0
    int DIMension(int array[]){
    return sizeof(array/sizeof(int);}
    main(){
    int arr[10];
    printf(“Array dimension is %d”,DIMension(arr));
    }
     
  2. kumar3749

    kumar3749 New Member

    Joined:
    Aug 2, 2011
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    Code:
    #include <stdio.h>
    #include<conio.h>
    void funarr(int arr[], int len)
    {
    printf("\nEnter the length of array :");
    scanf("%\nd",&len);
    printf("\nEnter the elements of the array :");
    for(i=0; i<len; i++)
    {
         scanf("%d",&arr[i]);
    }
    printf("\nThe elements of the array are as follows :");
    for(i=0; i<len; i++)
    {
        printf("\n%d",arr[i]);
    }
    }
    void main()
    {
    int myarr[100];
    clrscr();
    funarr(myarr, 7);
    getch();
    }
     
    Last edited by a moderator: Aug 2, 2011
  3. Ankur Kamboj

    Ankur Kamboj New Member

    Joined:
    Jun 19, 2011
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    0


    o/p will be same as you give the input in the array.
     
  4. xpi0t0s

    xpi0t0s Mentor

    Joined:
    Aug 6, 2004
    Messages:
    3,012
    Likes Received:
    203
    Trophy Points:
    0
    Occupation:
    Senior Support Engineer
    Location:
    England
    Why not grab yourself a compiler and try these things out?
     

Share This Page