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 so

 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

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 Q40; 4. X, y = 5; 5. 6. int main() 7. { 8. function (); 9. function (): 10. function (: return 0; 12. 3 13. function 040 14. 15. int x = 1; 16. static int y = 100;} 17. printf("x =1n", x); 18. printf("y= ", y): UFMFN7-15-1 (C Programming) 11. Page 4 of 6 19. 20. 21. x++; y++ } (b) (c) Consider the C-program in Q4(a), Explain the purpose of the keyword static. [3 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) PMAKS (d) Consider the following C fragment: if(a =5) { printf("a is 5 "); } else if (a 4) { printf("a is 4 "); } else { printf("a is unknown "); } Re-write this fragment 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!