A Semicolon at the end of a function signature indicates a
Forward declaration[
^] - a way of providing the signature of a method before the body has been defined so that it can be called before the body has been declared.
That allows this to work:
void foo()
{
bar();
}
void bar()
{
foo();
}
Without forward declarations, there is no way to write that code that means that the system can check the signatures of both functions!
void foo();
void bar();
...
void foo()
{
bar();
}
void bar()
{
foo();
}
Now the compiler can meet the body of both functions in either order.
C is an old language; modern languages like C# do not have this restriction!
So when you look at your code:
void temperature_convertor(int fahrenheit);
{
int C = (int fahrenheit - 32);
int Ce = int C * 5;
int celsius = (int Ce/9);
int kelvin = (int celsius + 273.15);
}
The semicolon at the end of the function signature turns it into a forward declaration, and the system doesn't know what to do with the rest of the code as it isn't contained in any function.
But when you have fixed that, your
temperature_convertor
function body will need changes as well: you don't need to specify variable types every time you use them!
For example:
int C = (int fahrenheit - 32);
won't work because you have the type definition
int
before the use of
fahrenheit
:
int C = fahrenheit - 32;
Will fix that, and so on.