Category:C: Difference between revisions
Content added Content deleted
Puppydrum64 (talk | contribs) |
Puppydrum64 (talk | contribs) m (→Functions) |
||
Line 46: | Line 46: | ||
A function is made up of three parts: its return type, its name, and its arguments. |
A function is made up of three parts: its return type, its name, and its arguments. |
||
<lang C>int main(void) //This is the function "main," which takes no arguments and returns a 32-bit signed integer value. |
<lang C>int main(void) //This is the function "main," which takes no arguments and returns a 32-bit signed integer value. |
||
int sum(int a,int b) //This is the function "sum," which takes two integer arguments and returns an integer. |
int sum(int a,int b) //This is the function "sum," which takes two integer arguments and returns an integer. |
||
⚫ | |||
void PlaySound(char songName) |
|||
⚫ | |||
⚫ | |||
//measured later.</lang> |
|||
⚫ | |||
//procedure whose outcome does not need to be measured or remembered later.</lang> |
|||
Note that the variable names listed as arguments when declaring a function are just for convenience. They need not be declared nor defined, nor do they refer to any variables in your program that happen to have the same name. It's only when a function is actually <i>used</i> are the argument variables required to exist. |
Note that the variable names listed as arguments when declaring a function are just for convenience. They need not be declared nor defined, nor do they refer to any variables in your program that happen to have the same name. It's only when a function is actually <i>used</i> are the argument variables required to exist. |