0
0
Cprogramming~5 mins

Function parameters - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What are function parameters in C?
Function parameters are variables listed in a function's definition. They act as placeholders for the values (arguments) passed to the function when it is called.
Click to reveal answer
beginner
How do you declare a function with two integer parameters in C?
You write the function name followed by parentheses containing the parameter types and names, for example:
void add(int a, int b) { /* code */ }
Click to reveal answer
beginner
What is the difference between parameters and arguments?
Parameters are the variables in the function definition. Arguments are the actual values you pass to the function when calling it.
Click to reveal answer
beginner
Can a function in C have no parameters? How?
Yes. You can declare a function with empty parentheses or with void inside, like void greet(void). This means the function takes no arguments.
Click to reveal answer
intermediate
What happens if you change a parameter value inside a function?
Changing a parameter inside a function only changes the local copy. The original variable passed as an argument outside the function stays the same.
Click to reveal answer
What keyword do you use to specify a function takes no parameters in C?
Anone
Bvoid
Cnull
Dempty
If a function is declared as int sum(int x, int y), what are x and y?
AReturn values
BArguments
CParameters
DConstants
What happens to the original variable if you change a parameter inside a function?
AOriginal variable stays the same
BOriginal variable changes
CProgram crashes
DParameter changes outside the function
How do you call a function named printMessage that takes no parameters?
AprintMessage(void);
BprintMessage{};
CprintMessage[];
DprintMessage();
Which of these is a correct function parameter list in C?
Aint a, float b
Bint a; float b;
C(int a, float b)
Dint a float b
Explain what function parameters are and how they differ from arguments.
Think about the function definition versus the function call.
You got /3 concepts.
    Describe what happens when you modify a parameter inside a function in C.
    Consider how C handles data passed to functions.
    You got /3 concepts.