ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
tip   SiteMap shows list of All Categories in this site.
Google
 
Categories >> Software >> Programming-Languages >> C++ >> C++-General
 
 
 
Question
Write any small program that will compile in "C" but not in
"C++"?
 Question Submitted By :: Guest
I also faced this Question!!     Rank Answer Posted By  
 
Answer
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++.
 
0
Mms Zubeir
 
View All Answers
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com