A

Admin • 802.91K Points
Coach

Q. What happens if we execute the following code in C and C++?

Code:
#include<stdio.h>
struct STRUCT
{
int x;
int f()
{
printf("Welcom to StackHowTo
");
}
};
int main()
{
struct STRUCT s;
s.f();
return 0;
}
  • (A) The program returns an error in C and C++
  • (B) The program returns an error in C++ but works perfectly in C.
  • (C) The program works correctly in C and C++ and displays “Welcom to StackHowTo” as output.
  • (D) The program returns an error in C but works perfectly in C++.
  • Correct Answer - Option(D)
  • Views: 4
  • Filed under category C++
  • Hashtags:

No solution found for this question.
Add Solution and get +2 points.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.