0
0
Cprogramming~10 mins

Function prototypes - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete 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'
Aadd
Bsum
Ccalculate
Dtotal
Attempts:
3 left
💡 Hint
Common Mistakes
Using a different function name than the one defined later.
Forgetting to specify the return type.
2fill in blank
medium

Complete 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'
Ashow
Bdisplay
CprintMessage
Dmessage
Attempts:
3 left
💡 Hint
Common Mistakes
Using an incorrect function name.
Leaving the parentheses empty instead of using 'void'.
3fill in blank
hard

Fix 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'
Amult
Bmultiply
Cproduct
Dmul
Attempts:
3 left
💡 Hint
Common Mistakes
Using a shortened or incorrect function name.
Misspelling the function name.
4fill in blank
hard

Fill 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'
Aint
Bfloat
CmaxValue
Dvoid
Attempts:
3 left
💡 Hint
Common Mistakes
Using the wrong return type like 'float' or 'void'.
Using an incorrect function name.
5fill in blank
hard

Fill 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'
Achar *
BconcatStrings
Cstr1
Dvoid
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'void' as return type instead of 'char *'.
Using wrong parameter names.