saving . . . saved Array and function call has been deleted. Array and function call has been hidden .
Array and function call
Title
Question
Why an array  can be not returned from a function ?

C-and-Cpp Arrays 01-02 min 10-20 sec 29-02-20, 1:19 p.m. avinashchouhan77

Answers:

Even though the entire array cannot be returned from a function, the pointer i.e. the starting address of an array can be returned. 

29-02-20, 2:33 p.m. ThiriTheWutYee


#include<stdio.h>
#include<conio.h>
void main()
{
int a[i],diff=0,n;
printf("enter the number of elements :");
scanf("%d",&n);
printf("enter the elements:");
for(i=0;i<n;i++)
scanf("%d",&a[i]);
for(i=0;i<=n;i++)
{
diff=a[i]-diff;
printf("difference of the elements stored in an array :%d",diff);
}
}


output :
enter the number of elements : 3
enter the elements :
20
10
5
difference of the elements stored in an array :5
12-08-24, 3:11 p.m. 238T1A05D9


#include<stdio.h>
#include<conio.h>
void main()
{
int a[i],diff=0,n;
printf("enter the number of elements :");
scanf("%d",&n);
printf("enter the elements:");
scanf("%d",&a[i]);
for(i=0;i<=n;i++)
{
diff=a[i]-diff;
printf("difference of the elements stored in an array :%d",diff);
}
}


output :
enter the number of elements : 3
enter the elements :
20
10
5
difference of the elements stored in an array :5
12-08-24, 3:12 p.m. Nikki5D4


#include<stdio.h>
#include<conio.h>
void main()
{
int a[i],diff=0,n;
printf("enter the number of elements :");
scanf("%d",&n);
printf("enter the elements:");
scanf("%d",&a[i]);
for(i=0;i<=n;i++)
{
diff=a[i]-diff;
printf("difference of the elements stored in an array :%d",diff);
}
}


output :
enter the number of elements : 3
enter the elements :
20
10
5
difference of the elements stored in an array :5
12-08-24, 3:17 p.m. 238T1A05D3


#include<stdio.h>
#include<conio.h>
void main()
{
int a[i],diff=0,n;
printf("enter the number of elements :");
scanf("%d",&n);
printf("enter the elements:");
scanf("%d",&a[i]);
for(i=0;i<=n;i++)
{
diff=a[i]-diff;
printf("difference of the elements stored in an array :%d",diff);
}
}


output :
enter the number of elements : 3
enter the elements :
20
10
5
difference of the elements stored in an array :5
12-08-24, 3:18 p.m. tanmayi.P


#include<stdio.h>
#include<conio.h>
void main()
{
int a[i],diff=0,n;
printf("enter the number of elements");
scanf("%d",&n);
printf("enter the array elements");
for(i=0;i<=n;i++)
scanf("%d",&a[i]);
for(i=0;i<=n;i++)
diff=a[i]-diff;
printf("diff of the elements:%d",diff);
getch();
}
12-08-24, 3:43 p.m. 238T1A05D8


#include<stdio.h>
#include<conio.h>
void main()
{
int a[i],diff=0,n;
printf("enter the number of elements :");
scanf("%d",&n);
printf("enter the elements:");
scanf("%d",&a[i]);
for(i=0;i<=n;i++)
{
diff=a[i]-diff;
printf("difference of the elements stored in an array :%d",diff);
}
}


output :
enter the number of elements : 3
enter the elements :
20
10
5
difference of the elements stored in an array :5
12-08-24, 3:50 p.m. Shalini_09


#include<stdio.h>
#include<conio.h>
void main()
{
int a[i],diff=0,n;
printf("enter the number of elements :");
scanf("%d",&n);
printf("enter the elements:");
scanf("%d",&a[i]);
for(i=0;i<=n;i++)
{
diff=a[i]-diff;
printf("difference of the elements stored in an array :%d",diff);
}
}
16-08-24, 5:02 p.m. 238T1A05F5


#include<stdio.h>
#include<conio.h>
void main()
{
int a[i],diff=0,n;
printf("enter the number of elements :");
scanf("%d",&n);
printf("enter the elements:");
for(i=0;i<n;i++)
scanf("%d",&a[i]);
for(i=0;i<=n;i++)
{
diff=a[i]-diff;
printf("difference of the elements stored in an array :%d",diff);
}
}


output :
enter the number of elements : 2
enter the elements :
20
10
difference of the elements stored in an array :10
19-08-24, 2:22 p.m. 238T1A05G7


#include<stdio.h>
#include<conio.h>
void main()
{
int a[i],diff=0,n;
printf("enter the number of elements :");
scanf("%d",&n);
printf("enter the elements:");
for(i=0;i<n;i++)
scanf("%d",&a[i]);
for(i=0;i<=n;i++)
{
diff=a[i]-diff;
printf("difference of the elements stored in an array :%d",diff);
}
}


output :
enter the number of elements : 2
enter the elements :
20
10
difference of the elements stored in an array :10
19-08-24, 3:19 p.m. nasreensk2005@gmail.com


#include<stdio.h>
#include<conio.h>
void main()
{
int a[i],diff=0,n;
printf("enter the number of elements :");
scanf("%d",&n);
printf("enter the elements:");
for(i=0;i<n;i++)
scanf("%d",&a[i]);
for(i=0;i<=n;i++)
{
diff=a[i]-diff;
printf("difference of the elements stored in an array :%d",diff);
}
getch();
}

output :
enter the number of elements : 2
enter the elements :
20
10
difference of the elements stored in an array :10
19-08-24, 3:55 p.m. 238T1A05G1


Log-in to answer to this question.