Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


how to return 1000 variables from functio9n in c?plz give me
code also

Answers were Sorted based on User's Feedback



how to return 1000 variables from functio9n in c?plz give me code also..

Answer / vignesh1988i

SEE /... we cant return 1000 variables at a time ... using
call by value...... only call by reference can do it....
tat is. usage of pointers...... since it will change
directly in the address itself.... that's a specality...


#include<stdio.h>
#include<conio.h>
void fun(int *,int *,int *.............1000 int's );
void main()
{
int a1,b1,c1,d1,.............a1000;
fun(&a1,&a2,...... &a1000);
for(int i=0;i<1000;i++)
printf("\n %d",a1);
getch();
}
void fun(int *a1,int *b2,.......... 1000 ptr declarations)
{
*a1=1;
*a2=2
.
.
.
.
.
.
100th varaible =1000;
}

Is This Answer Correct ?    9 Yes 2 No

how to return 1000 variables from functio9n in c?plz give me code also..

Answer / ramachandran

#include<stdio.h>
int fun(int *a)
{
return ++(*a);
}

int main()
{
int a=0,i,d;
for(i=0;i<100;i++)
{
d=fun(&a);
printf("\n%d",d);
}
getch();
}

Is This Answer Correct ?    5 Yes 1 No

how to return 1000 variables from functio9n in c?plz give me code also..

Answer / codee

extending the previous answer by passing array instead of
all variables

Is This Answer Correct ?    5 Yes 2 No

how to return 1000 variables from functio9n in c?plz give me code also..

Answer / mishra@deepa

the first answer is quite long......

just pass an array(1000 elements) and return that.....

Is This Answer Correct ?    4 Yes 2 No

how to return 1000 variables from functio9n in c?plz give me code also..

Answer / y hussain reddy

#include<stdio.h>
void main()
{
int *a;
a=(int*)malloc(200);
void f(int *);
f(a);

for(i=0;i<100;i++)
printf("%d ",a[i]);
}
void f(int *a)
{

int i;
for(i=0;i<100;i++)
a[i]=i;
}

Is This Answer Correct ?    0 Yes 3 No

how to return 1000 variables from functio9n in c?plz give me code also..

Answer / vignesh1988i

you r right sir.... but he has asked 1000 VARIABLES.. so
only i done in this way.....

Is This Answer Correct ?    0 Yes 4 No

Post New Answer

More C Interview Questions

Explain what is the difference between far and near ?

0 Answers  


What are the application of c?

0 Answers  


write a program to fined second smallest and largest element in a given series of elements (without sorting)

9 Answers   Yahoo,


‎How to define structures? · ‎

0 Answers  


1. Write a function to display the sum of two numbers in the following ways: By using (i) pass by value (ii) pass by address a. function with argument and with return value b. function with argument and without return value c. without argument , with return value d. without argument , without return value Note: Use pass by address.

0 Answers  


input any 4 digit number and find the difference of all the digits?

3 Answers   Google,


Convert the following expression to postfix and prefix X $ Y Z - M + N + P / Q / (R + S)

2 Answers  


Explain what happens if you free a pointer twice?

0 Answers  


What is C language Terminator?

15 Answers   TCS,


Can you please explain the difference between syntax vs logical error?

0 Answers  


What is nested structure in c?

0 Answers  


study the code: #include<stdio.h> void main() { const int a=100; int *p; p=&a; (*p)++; printf("a=%dn(*p)=%dn",a,*p); } What is printed? A)100,101 B)100,100 C)101,101 D)None of the above

15 Answers   Accenture, TCS,


Categories