Search This Blog

Friday, April 4, 2025

functions and pointers Program 1

 What will happen when you run this program?




   a) Compile time error: mismatch of data type of function argument in line 7
   b) Prints garbage
   c) Prints 11 and 21
   d) Prints 11 and 22

Type your answer in a comment.



5 comments:

  1. After writing this code, compiling it, then running it, I can tell you with certainty that it prints 11 and 22. D.

    ReplyDelete
    Replies
    1. that is correct. Did you try to guess the output without running it?

      Delete
  2. Compile time Error, need to declare function prototype

    ReplyDelete
  3. The semantics of expressions containing unsequenced side effects on a particular variable are undefined in C, per §6.5 ¶2 of the C11 standard (albeit the working draft is all I am privy to). As the two possible executions of the expression on line 7 are not confluent, the best answer is B.

    ReplyDelete