Question: Question 4 [Total: 20 Marks] (@) Consider the following C-program that fails to compile due to syntax errors. Identify the errors and correct the program

 Question 4 [Total: 20 Marks] (@) Consider the following C-program that
fails to compile due to syntax errors. Identify the errors and correct

Question 4 [Total: 20 Marks] (@) Consider the following C-program that fails to compile due to syntax errors. Identify the errors and correct the program so that it compiles successfully. What will be the output when the program is executed successfully? 19 Marks] 1. #include 2. #include 3. void function 040: 4. 1, y 5; 5. 6. int main() 7. 1 8. function (): 9. function (: 10. function (): 11. return 0; 12. 13. function 040 14. 15. intx1: 16. static int y 100:1 17. printf(" ",x); 18. printf("y in ", y: UFMFN7-15-1 C Programming) Page 4 of 6 19. 20. 21. (b) Consider the C-program in Q4(a). Explain the purpose of the keyword static. 13 Marks] Consider the C-program in Q4(a), identify the global and local variables. What is the importance of global variables in a C-program? [3 Marks] Consider the following C fragment: (d) if(-5) { printf("a is 5 "); 3 else if (4) { printf("a is 4 "); 1 clse { printf("a is unknown'n"); Re-write this fraumat using a switch statement 15 Marks

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!