Skip to content
Related Articles

Related Articles

Improve Article

C | Operators | Question 9

  • Difficulty Level : Easy
  • Last Updated : 04 Feb, 2013
Geek Week

Output of following program?




#include <stdio.h>
int f1() { printf ("Geeks"); return 1;}
int f2() { printf ("Quiz"); return 1;}
  
int main()
{
  int p = f1() + f2();
  return 0;
}

(A) GeeksQuiz
(B) QuizGeeks
(C) Compiler Dependent
(D) Compiler Error


Answer: (C)

Explanation: The operator ‘+’ doesn’t have a standard defined order of evaluation for its operands. Either f1() or f2() may be executed first. So a compiler may choose to output either “GeeksQuiz” or “QuizGeeks”.

Take a step-up from those “Hello World” programs. Learn to implement data structures like Heap, Stacks, Linked List and many more! Check out our Data Structures in C course to start learning today.
My Personal Notes arrow_drop_up
Recommended Articles
Page :