1. ## Function Arguments...?

Could someone please explain to me what the following text in the bold does:

e.g.

exampleFunction(int square, int circle)

Why wouldnt you just use this:

exampleFunction()
{
int square;
int circle;
} 2. those are the parameters. they are used to pass values to the function

example:
Code:
```int squared(int x)
{
return x*x;
}```
now you can call it like:
squared(2)
and it will return 4.
if you could send it the value (2), it wouldn't be able to return the result (4) because it would have nothing to work with.

they're like local variables (local to the function), only when you call the function you can give them a value. Function's parameters is the functions way to access variables that are declared outside the function itself...

you can also use global variables, or data members if you are making a class or struct. 4. Thanks guys, that helped alot

EDIT: MadHatter: Does that mean x becomes 2?

So basically this is to mak the function more flexible? I get ya 5. yes, in this case x becomes 2. it's sort of like this...

Code:
```//function
int func(int x)
{
return x*x;
}

//function call
int someVar = func(7);

/*This would be the same as*/

//function
int func()
{
return 7*7;
}

//function call
int someVar = func();```
so using parameters makes it so you can use any value.
hopefully that helped a little, rather than confusing you more... 6. Originally posted by ammar
you can also use global variables
I can't believe you're telling a newbie that he can use global variables. Why don't you just tell him to use void main?

Eminence, don't use global variables. It's bad for a number of reasons.
Code:
```// Bad
int num;
int square(int x);
int main()
{
cout << num << " squared is " << square(num);
}

// Good
int square(int x);
int main()
{
int num;	// notice that all of the variables are declared within functions, in this case main
cout << num << " squared is " << square(num);
}```
This may be a simple example, but when you get to coding examples it will be very difficult to debug a program that uses global variables. The only global identifiers you should use are constants. Also, global variables are diametrically opposed to the concept of data encapsulation. In short, don't use global variables. Popular pages Recent additions
{"ft_lang_label":"__label__en","ft_lang_prob":0.9056805,"math_prob":0.9746032,"size":3252,"snap":"2019-43-2019-47","text_gpt3_token_len":771,"char_repetition_ratio":0.13793103,"word_repetition_ratio":0.27719298,"special_character_ratio":0.2503075,"punctuation_ratio":0.15350224,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9745434,"pos_list":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16],"im_url_duplicate_count":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2019-11-13T13:31:46Z\",\"WARC-Record-ID\":\"<urn:uuid:9c575a69-afae-4ca3-bda2-e592af009263>\",\"Content-Length\":\"62209\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:b78a70a4-5454-4281-afe1-86a4c7c06f84>\",\"WARC-Concurrent-To\":\"<urn:uuid:60ebe5a4-334e-4f16-8ece-1b8814ff0942>\",\"WARC-IP-Address\":\"198.46.93.160\",\"WARC-Target-URI\":\"https://cboard.cprogramming.com/cplusplus-programming/31479-function-arguments.html?s=5b067f0efb96bbfe70e7f6cd23c05686\",\"WARC-Payload-Digest\":\"sha1:2MI26XONHYYEXBQVW7RPNWSYTOT7M2L7\",\"WARC-Block-Digest\":\"sha1:2M55FGCYRHIYLRCWYZ6AQDPO7573K7CK\",\"WARC-Identified-Payload-Type\":\"application/xhtml+xml\",\"warc_filename\":\"/cc_download/warc_2019/CC-MAIN-2019-47/CC-MAIN-2019-47_segments_1573496667260.46_warc_CC-MAIN-20191113113242-20191113141242-00373.warc.gz\"}"}