Passing double value to a function in C

By: Emiley J Emailed: 1648 times Printed: 2122 times    

Latest comments
By: rohit kumar - how this program is work
By: Kirti - Hi..thx for the hadoop in
By: Spijker - I have altered the code a
By: ali mohammed - why we use the java in ne
By: ali mohammed - why we use the java in ne
By: mizhelle - when I exported the data
By: raul - no output as well, i'm ge
By: Rajesh - thanx very much...
By: Suindu De - Suppose we are executing

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 

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;
}


C Home | All C Tutorials | Latest C Tutorials

Sponsored Links

If this tutorial doesn't answer your question, or you have a specific question, just ask an expert here. Post your question to get a direct answer.



Bookmark and Share

Comments(0)


Be the first one to add a comment

Your name (required):


Your email(required, will not be shown to the public):


Your sites URL (optional):


Your comments:



More Tutorials by Emiley J
Password must include both numeric and alphabetic characters - Magento
What is Hadoop?
Returning multiple values from a web service
Tomcat and httpd configured in port 8080 and 80
Java Webservices using Netbeans and Tomcat
Java WebService connected to Database
How to Deploy a Java Web Service
Call a webservice in Java
Java WebService - Create your first web service in Java
package javax.jws does not exist
Getting Started with Android
HTML5 Location - getCurrentPosition() in HTML5
HTML5 Canvas - Using Canvas in HTML5
HTML5 - Introduction
HTML5 Video - Handling video in HTML5

More Tutorials in C
Sum of the elements of an array in C
Printing a simple histogram in C
Sorting an integer array in C
Find square and square root for a given number in C
Simple arithmetic calculations in C
Command-line arguments in C
Calculator in C
Passing double value to a function in C
Passing pointer to a function in C
Infix to Prefix And Postfix in C
while, do while and for loops in C
Unicode and UTF-8 in C
Formatting with printf in C
if, if...else and switch statements in C with samples
Statements in C

More Latest News
Most Viewed Articles (in C )
Using memset(), memcpy(), and memmove() in C
External Variables and Scope in C
perror() Function - example program in C
Passing double value to a function in C
Printing a simple histogram in C
goto and labels in C
lseek() sample program in C
assert() Function Example program in C
Sum of the elements of an array in C
#if, #elif, #ifndef, #ifdef in C (Conditional Inclusion)
UNIX read and write system calls sample program in C
Listing Files and Directories sample program in C
Bitwise Logical Operators in C
Find square and square root for a given number in C
Symbolic Constants using #define in C
Most Emailed Articles (in C)
Multi-dimensional Arrays in C (Explained using date conversion program)
Open, Creat, Close, Unlink system calls sample program in C
Formatting with printf in C
Unicode and UTF-8 in C
Character Arrays in C
Macro Substitution using #define in C
Pointer Arrays and Pointers to Pointers in C
UNIX read and write system calls sample program in C
Arguments - Call by Value in C
Pointers vs. Multi-dimensional Arrays in C
Using Bit-field in C
lseek() sample program in C
while, do while and for loops in C
Sum of the elements of an array in C
Sorting an integer array in C