[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Re: [CPROG] pass by reference



Jeg fik selv løst det ;-)

 float* calculate_value(float* value){
   *value= 2*5.4;
   return value;
 }

 int main(int argc, char **argv){
   float value;

   calculate_value(&value);

   printf("value= %f\n", value); //skriver 0.0 i stedet for 10.8
 }


> Kære c-sprog,
>
> hvordan får jeg flg. eksempel til at tildele 'value' i main værdien
> beregnet i calculate_value?
>
> float calculate_value(float value){
>   value= 2*5.4;
>   return value;
> }
>
> int main(int argc, char **argv){
>   float value;
>
>   calculate_value(value);
>
>   printf("value= %f\n", value); //skriver 0.0 i stedet for 10.8
> }
>
> med venlig hilsen
> Marie Louise





 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 20:09 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *