Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to declare a variable in embedded C.
Embedded C
int [1] = 10;
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using a number as a variable name.
Using a keyword as a variable name.
✗ Incorrect
The variable name should be a valid identifier like count.
2fill in blank
mediumComplete the code to include the standard input-output header in embedded C.
Embedded C
#include [1]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using quotes instead of angle brackets for standard headers.
Including the wrong header file.
✗ Incorrect
The standard way to include the input-output header is #include <stdio.h>.
3fill in blank
hardFix the error in the embedded C function declaration.
Embedded C
void [1]() { } Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using uppercase 'Main' instead of 'main'.
Using a return type as the function name.
✗ Incorrect
The entry point function in embedded C is main with lowercase 'm'.
4fill in blank
hardFill both blanks to create a simple infinite loop in embedded C.
Embedded C
while ([1]) { [2]; }
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 0 as the condition which stops the loop.
Using break inside the loop which exits it.
✗ Incorrect
An infinite loop uses while(1) and continue; to keep running.
5fill in blank
hardFill all three blanks to define and call a function that returns the sum of two integers.
Embedded C
int [1](int a, int b) { return a [2] b; } int result = [3](5, 3);
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using different names for function definition and call.
Using wrong operator for addition.
✗ Incorrect
The function name is add, the operator is +, and the call uses add.