Sign in to follow this  
Avont29

C++ Arguments

Recommended Posts

Guest Anonymous Poster
void func(int arg1, float arg2, string arg3)

Share this post


Link to post
Share on other sites
Consider the following function, which adds two numbers together.

int add(int number1, int number2)
{
return number1 + number 2;
}


"number1" and "number2" are the arguments of the "add" function. When we call "add" we "pass" values to that function in it's arguments:

int one = 1;
int two = 2;

// here we pass the variables "one" and "two" as arguments to the add function
int sum = add(one,two);


Does that help?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this