[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



Ok, og tusind tak.

> Det er rigtigt nok, men du kunne godt bare kalde funktionen:
>
> void calculate_value( float *value )
>   {
>   *value=2.0*5.4;
>   }
>
> I dit main-program bruger du alligevel ikke funktionens returværdi til
> noget
>
> m.v.h.
> Søren
>
>
> sslug@sslug wrote:
>>
>> 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] *