Warning: implode(): Invalid arguments passed in /www/wwwroot/jobquiz.info/mdiscuss.php on line 336 What will be the output of the program? #include<stdio.h> int check(int); int main() { int i=45, c; c = check(i); printf("%d\n", c); return 0; } int check(int ch) { if(ch >= 45) return 100; else return 10; } ?->(Show Answer!)
1. What will be the output of the program? #include<stdio.h> int check(int); int main() { int i=45, c; c = check(i); printf("%d\n", c); return 0; } int check(int ch) { if(ch >= 45) return 100; else return 10; }
Ask Your Doubts Here
Comments
By: guest on 01 Jun 2017 06.01 pm
Step 1: int check(int); This prototype tells the compiler that the function check() accepts one integer parameter and returns an integer value. Step 2: int l=45, c; The variable i and c are declared as an integer type and i is initialized to 45. The function check(i) return 100 if the given value of variable i is >=(greater than or equal to) 45, else it will return 10. Step 3: c = check(i); becomes c = check(45); The function check() return 100 and it get stored in the variable c.(c = 100) Step 4: printf("%d\n", c); It prints the value of variable c. Hence the output of the program is '100'.