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

How does work in c++?

592


How many types of classes are there in c++?

590


List the issue that the auto_ptr object handles?

609


What is this pointer in c++?

731


Why is c++ is better than c?

514






Explain what is oop?

618


What is the use of seekg in c++?

594


Can we delete this pointer in c++?

679


total amount of milk produced each morning and then calculates and outputs the number of cartons needed for this milk , the cost of producing the milk and the profit from producing this milk.

2078


What is the use of main function in c++?

522


Can we specify variable field width in a scanf() format string? If possible how?

657


What is an overflow error?

615


can any one help to find a specific string between html tags which is changed to a sting.. weather.html looks (for location) is somewhere #include #include #include using namespace std; string find_field(string myPage,string); int main (void) { string page, line, location, temperature; ifstream inputFile("weather.xml"); while(getline(inputFile, line)) { page.append(line); line.erase(); } // Now page is a string that contains the whole xml page // Here you need to write something that finds and // extracts location and temperature from the XML // data in the string page and stores them in // the strings location and temperature respectively location=find_field(page,"location"); temperature=find_field(page,"temp_c"); cout << "Location: "<

1639


What is isdigit c++?

569


int age=35; if(age>80) {Console.WriteLine("Boy you are old");} else {Console.WrieLine("That is a good age");}

828