Bird
0
0

Find the problem in this task function: void Task(void *pvParameters) { int value = *pvParameters; // rest of code }

medium📝 Debug Q7 of 15
FreeRTOS - Task Creation and Management
Find the problem in this task function: void Task(void *pvParameters) { int value = *pvParameters; // rest of code }
ACannot dereference void pointer directly
BReturn type should be int
CParameter should be int*
DFunction missing return statement
Step-by-Step Solution
Solution:
  1. Step 1: Analyze pointer usage

    pvParameters is a void pointer; it cannot be dereferenced directly without casting.
  2. Step 2: Identify correct usage

    Must cast pvParameters to appropriate pointer type before dereferencing.
  3. Final Answer:

    Cannot dereference void pointer directly -> Option A
  4. Quick Check:

    Dereference void* only after casting [OK]
Quick Trick: Always cast void* before dereferencing [OK]
Common Mistakes:
  • Dereferencing void* directly
  • Ignoring pointer type safety
  • Assuming void* behaves like int*

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More FreeRTOS Quizzes