Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to declare a function prototype for a function named add that takes two integers and returns an integer.
C
int [1](int a, int b); Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using a different function name than the one defined later.
Forgetting to specify the return type.
✗ Incorrect
The function prototype declares a function named 'add' that takes two integers and returns an integer.
2fill in blank
mediumComplete the function prototype for a function named printMessage that takes no parameters and returns nothing.
C
void [1](void); Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using an incorrect function name.
Leaving the parentheses empty instead of using 'void'.
✗ Incorrect
The prototype declares a function named 'printMessage' that takes no parameters and returns void.
3fill in blank
hardFix the error in the function prototype for multiply that takes two floats and returns a float.
C
float [1](float x, float y); Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using a shortened or incorrect function name.
Misspelling the function name.
✗ Incorrect
The correct function name is 'multiply' matching the intended function.
4fill in blank
hardFill both blanks to declare a function prototype named maxValue that takes two integers and returns an integer.
C
[1] [2](int a, int b);
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using the wrong return type like 'float' or 'void'.
Using an incorrect function name.
✗ Incorrect
The return type is 'int' and the function name is 'maxValue'.
5fill in blank
hardFill all three blanks to declare a function prototype named concatStrings that takes two pointers to char and returns a pointer to char.
C
[1] [2](char *[3], char *str2);
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'void' as return type instead of 'char *'.
Using wrong parameter names.
✗ Incorrect
The function returns 'char *', is named 'concatStrings', and the first parameter is 'char *str1'.