Programming Tutorials

(追記) (追記ここまで)

Passing double value to a function in C

By: Emiley J in C Tutorials on 2010年04月16日 [フレーム]

This sample program in C demonstrates the concept of passing a double value to a function as parameter. The program accepts a number in feet and converts the feet into meters by using a conversion function.

#include <stdio.h>
double feet_to_meter(double f);
int main(void)
{
 double feet;
 printf("Enter feet: ");
 scanf("%lf", &feet);
 printf("Meters: %f", feet_to_meter(feet));
 return 0;
}
double feet_to_meter(double f)
{
 return f / 3.28;
}



(追記) (追記ここまで)


Add Comment

JavaScript must be enabled for certain features to work
* Required information
1000

Comments

No comments yet. Be the first!
(追記) (追記ここまで)
(追記) (追記ここまで)

AltStyle によって変換されたページ (->オリジナル) /