Look up functions in C. In fact reading the first few pages of a C tutorial will take you a long way. In short a function does some operation then returns the result or it may not return anything. So lets break down what you've got and what it does.
When you write int main(void)
you're telling the compiler that you have a function that returns an integer (that's the int
part). The name of this function is main
. And you do not need to provide it anything to get started (void
). You can't have more than one function of the same name because the compiler doesn't know which to use. main
is a special function that is called automatically when the program runs.
To prompt a user to input a value, you need to print the prompt (which you almost did with printf(Enter value for a(in feet): \n");
except you forgot "
before Enter). Then you need to read the user's input from the keyboard. In C, the keyboard input comes from a File Descriptor known as stdin
. To read from stdin
, one option is to use fscanf as in this example. That should get you going. Good luck and happy reading.