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

Describe private, protected and public – the differences and give examples.

888


What is meant by entry controlled loop?

893


When does a name clash occur in c++?

958


what is C++ objects?

953


Does c++ have finally?

778


How a new element can be added or pushed in a stack?

822


Which field is used in c++?

858


How would you use the functions memcpy(), memset(), memmove()?

898


What is a stack? How it can be implemented?

948


What type of question are asked in GE code writing test based on c++ data structures and pointers?

3744


A company pays its salespeople on a commission basis. The salespeople receive $200 per week plus 9 percent of their gross sales for that week. For example, a saleperson who sells $5000 worth of merchandise in a week receives $200 plus 9 percent of $5000, or a total of $650. You have been supplied with a list of items sold by each salesperson. The values of these items are as follows: Item Value A 239.99 B 129.75 C 99.95 D 350.89 Write a program that inputs one salesperson's items sold in a week (how many of item A? of item B? etc.) and calculates and displays that salesperson's earnings for that week.

3665


How to implement is-a and has-a class relationships?

811


What are pointer-to-members? Explain.

848


What is the best free c++ compiler for windows?

850


Write a function to find the nth item from the end of a linked list in a single pass.

784