Monday, September 23, 2013
FUNCTIONS
What is a function?
A function is a piece of code that does stuff. Its like the printf command yo. When you use it, it does stuff. Like print something to the screen. That kind of stuff.
What do they look like in code?
like printf or scanf or stuff yo.
How do you write a function and use one?
First you declare the function using variables and stuff. Then you use the function in the code, and then you initialize the function below the main body. Cause its cool.
Provide an example of a function you’ve recently written or used.
I DON WANNA
int Add(int, int);
//BODYSTUFFHERE
int add(int x, int y)
{
return x+y;
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment