Jump to content
  • Advertisement
Sign in to follow this  
Avont29

C++ Arguments

This topic is 4777 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

im really not understanding what an argument is, can someone please help me to understand.. thanks in advance

Share this post


Link to post
Share on other sites
Advertisement
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!