ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
tip   To Refer this Site to Your Friends   Click Here
Google
 
Categories >> Code-Snippets >> Programming-Code >> C-Code
 
 
 
Question
How to return multiple values from a function?
 Question Submitted By :: Solidcube
I also faced this Question!!     Rank Answer Posted By  
 
Answer
Make array of values and return the array address as long. 
simple example:
void main()
{
 int a[10],i,n;
 int *new_value_array;
 printf("\n Enter how many number you want to enter? ");
 scanf("%d",&n);
 for(i=0;i<n;i++)
 sacnf("%d",&a[i]);
 printf("\n old value of the array is:");
 for(i=0;i<n;i++)
 printf("\t%d",a[i]);
 new_value_array = array_modify(a,n);
 printf("\n new value of the array is: \n");   
 for(i=0;i<n;i++)
 printf("\t%d",*(new_value_array+i));
 getch();
}
 int *array_modify(int a[10],int n)
{
 int i;
 for(i=0;i<n;i++)
 a[i]=a[i]*4;
 return(a);
}
 
0
Prasanta Maiti
 
View All Answers
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com