Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   what should be the output? (http://www.go4expert.com/forums/output-t26422/)

Ankur Kamboj 2Aug2011 12:54

what should be the output?
 
int DIMension(int array[]){
return sizeof(array/sizeof(int);}
main(){
int arr[10];
printf(“Array dimension is %d”,DIMension(arr));
}

kumar3749 2Aug2011 16:31

Re: what should be the output?
 
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();
}


Ankur Kamboj 2Aug2011 18:09

Re: what should be the output?
 
Quote:

Originally Posted by kumar3749 (Post 85644)
#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();
}

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

xpi0t0s 3Aug2011 12:56

Re: what should be the output?
 
Why not grab yourself a compiler and try these things out?


All times are GMT +5.5. The time now is 09:55.