#include <stdio.h>void inc_count(int count){count ++;}int main(){int count = 0; /* number of times through */while (count < 10)inc_count(count);return count ;}What will be the value returned by the function main?A. 0B. 10C. 9D. Null

Showing Answers 1 - 9 of 9 Answers

hi guys,,
seems to me as an infinite loop as the variable count in main() does'nt get incremented,,,so it is always 0....then what would be the correct answer among the options?????

  Was this answer useful?  Yes

anu1985

  • Jun 9th, 2008
 

checking while condition ,it will enter while loop control transfer to function increment count as seen count is a local variable this increment will not be reflect in main function
and will return 0 to  main again control is in main.infinite loop will occure

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions