I've written the following C function but it is not working correctly. What did I do wrong?   int *double5(void) {     int i = 5;     i = i *2;     return &i;} Group of answer choices You can never return a pointer to a local variable. It's not possible for a function to return a pointer The variable has to be a global variable The function has to be of type void

icon
Related questions
Question
  1. I've written the following C function but it is not working correctly. What did I do wrong?

 

int *double5(void) {
     int i = 5;
     i = i *2;
     return &i;
}

Group of answer choices
You can never return a pointer to a local variable.
It's not possible for a function to return a pointer
The variable has to be a global variable
The function has to be of type void
AI-Generated Solution
AI-generated content may present inaccurate or offensive content that does not represent bartleby’s views.
steps

Unlock instant AI solutions

Tap the button
to generate a solution