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++"?

Answers were Sorted based on User's Feedback



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

Answer / sathish kumar

Hi All,

U can write many programs which will compile in C and not
in C++. Sample program.

const i; /* this is possible in C but not in C++ */
const int i; // it should be done like this in C++.


Thanks & Regards
Sathish Kumar

Is This Answer Correct ?    10 Yes 2 No

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

Answer / nousilal badavath

int new;//allowed in c but not in c++ because in c++

Is This Answer Correct ?    7 Yes 1 No

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

Answer / aashish kumar nath

We can do many programs which will run in C but not in C++
like if we declare

int class=8 /*It will run in C but not in c++ */

Is This Answer Correct ?    6 Yes 1 No

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

Answer / 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

More C++ General Interview Questions

Can union be self referenced?

0 Answers  


Define what is constructor?

0 Answers  


What are c++ redistributables?

0 Answers  


What is null pointer and void pointer?

0 Answers  


what are Access specifiers in C++ class? What are the types?

0 Answers  


daily Routine of father

0 Answers  


Does c++ have a hash table?

0 Answers  


Enter n no. of element and delete value from desire position

1 Answers  


Explain the ISA and HASA class relationships. How would you implement each in a class design?

3 Answers  


How can we access protected and private members of a class?

0 Answers  


What is a hashmap c++?

0 Answers  


If a function doesn’t return a value, how do you declare the function?

0 Answers  


Categories