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

Answer Posted / karunesh

int GetNum()
{

printf("this will compile under c but not in c++");

}

you will get a error under g++ funtion should return int
while in c i will work with warning.

Is This Answer Correct ?    0 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the best c++ book?

954


What is a friend function in c++?

997


What are pointers, when declared, intialized to a) NULL b) Newly allocated memory c) Nothing. Its random

873


What is endl c++?

822


How to get the current position of the file pointer?

761






What is the use of class in c++?

758


Explain the benefits of proper inheritance.

836


Difference between overloading vs. Overriding

792


Explain static and dynamic memory allocation with an example each.

825


Explain the difference between class and struct in c++?

772


Is recursion allowed in inline functions?

780


What is the full form of india?

757


What is the difference between C and CPP?

816


How important is c++?

697


How do I write a c++ program?

783