TripleX Game Level Difficulty vs Difficulty

Hi! Thank you for your time.

I know that there was a post similar by StevenNani “Someone explain to me what I just did.”
It cleared up quite a lot for me as far as my confusion as to how blevelcomplete, level difficulty and difficulty all communicate with each other.

I just wanted to ask for a clarification on one thing. What is the code that basically establishes LevelDifficulty in PlayGame(LevelDifficulty) in the main as equal to (int Difficulty)?

Is it the bool function bool PlayGame(int Difficulty) ?

Thank you in advance!

Everything was explained very well so far but this portion of the code really confused me as I couldn’t figure out how they could all communicate while having different names and I’m not sure what code links all of them together.

Functions are called with arguments

int square(int n)
{
    return n * n;
}

int main()
{
    int val = square(3);
    int val2 = square(val);
}

First line of main calls square with the value of 3 which initialises the parameter n to 3, multiplies by itself and that value returned which is then used to initialise the variable val which would be 9.

The second line calls square again with the value of val (9), which initialises n, multiplied by itself and returned which again initialises the variable val2 which would be the value 81.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms