Write any small program that will compile in "C" but not
in "C++"

Answer Posted / murali

hi(){ }

g++ -x c++ -c test1.cpp
test1.cpp:1: ISO C++ forbids declaration of `hi' with no
type

gcc -x c -c test1.cpp
Here the default return type is int.

Is This Answer Correct ?    6 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is rust better than c++?

618


the maximum length of a character constant can be a) 2 b) 1 c) 8

617


Snake Game: This is normal snake game which you can find in most of the mobiles. You can develop it in Java, C/C++, C# or what ever language you know.

2448


Write a program using shift_half( ) function to shift the elements of first half array to second half and vice versa.

802


What is iomanip c++?

606






Mention the purpose of istream class?

632


What is setiosflags c++?

541


Difference between a copy constructor and an assignment operator.

583


Define the operators that can be used with a pointer.

585


What are the advantages of c++ over c?

596


write a corrected statement so that the instruction will work properly. if (4 < x < 11) y = 2 * x;

1523


Explain the differences between private, public and protected and give examples.

582


If you push the numbers (in order) 1, 3, and 5 onto a stack, which pops out first a) 1 b) 5 c) 3

844


Please explain class & object in c++?

612


What is general format for a prototype?

607