Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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

Answer Posted / mms zubeir

There are some features in C that are truncated in C++. To
quote a few,

1. const int pi; // allowed in C.
const int pi = 3.14; // equivalent in C++.

2. char name[10];
for(int index = 0; index < 50; ++index)
{
scanf("%s", &name[index]); // sorry, I am weak in C.
}

This is allowed in C. That is, the array range checking
is not done in C. In C++, it will throw an out of range
error.

3. void function()
{
....
}

int main()
{
function(299);
return 0;
}

This is allowed in C but not in C++.

Is This Answer Correct ?    4 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can constructor be static in c++?

1049


Describe the syntax of single inheritance in C++?

1020


What is expression parser in c++

2414


What is null pointer and void pointer?

1008


What are put and get pointers?

1065


Which is not a valid keyword a) public b) protected c) guarded

1192


Differentiate between late binding and early binding. What are the advantages of early binding?

974


Differentiate between the manipulator and setf( ) function?

1096


What parameter does the constructor to an ofstream object take?

1004


What does 7/9*9 equal ? a) 1 b) 0.08642 c) 0

909


Does c++ cost money?

951


Which format specifier is used for printing a pointer value?

1007


How do you write a function that can reverse a linked-list?

1052


What are maps in c++?

903


Explain how to initialize a const member data.

982