Question: #include void func_02 ( int *num2) { (*num2) = (*num2) -1 ; } void func_01 ( int *num1) { (*num1) = (*num1) - 1 ;

#include void func_02(int *num2){ (*num2) = (*num2) -1; } void func_01(int *num1){ (*num1) = (*num1) - 1; func_02(num1); } int main() { int num = 10; func_01(&num); printf("new num is %d", num); return 0; }

Q1) Edit the code to remove the & character from the main when we call func_01(&num) to it will be func_01(num). Compile and run your code, what is the result, why?

Q1.2) According to func_02(int *num2) prototype we should pass to it an argument by reference or by a pointer. However, when we call it inside func_01 we do not use the & character as we did in the main with func_01(&num). Why do you think we did that?

Q1.3) Edit the code again to put it back in its original state, where the & character is used in the main when we call func_01(&num). Compile the code and make sure it runs as expected. Now, edit the code again to add the & character in func_01 when you call func_02(num1), so it becomes func_02(&num1). Compile and run your code, what is the result, why?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!