GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Tech FAQs  >  OOPS
Go To First  |  Previous Question  |  Next Question 
 OOPS  |  Question 37 of 258    Print  
Write any small program that will compile in "C" but not in "C++"

  
Total Answers and Comments: 4 Last Update: May 15, 2008   
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
August 30, 2005 06:29:19   #1  
Ruth Samuel        

RE: Write any small program that will compile in "C" but not in "C++"
There is nothing like that. A program written in C can be compiled in C++ also. Class declaration is not compulsary in C++ though it follows OOPS concept.
But it needs at least one Class declaration for a Java program to be compiled.[LIST]null

 
Is this answer useful? Yes | No
July 31, 2007 07:51:10   #2  
Sajeesh        

RE: Write any small program that will compile in "C" ...
int main()
{
int class 10;
printf(" d" class);
return 0;
}

 
Is this answer useful? Yes | No
August 03, 2007 06:34:37   #3  
vipin gupta Member Since: October 2006   Contribution: 21    

RE: Write any small program that will compile in "C" but not in "C++"
The following program compiles with 'C' with a warning about return type of main. But it wouldn't compile with 'C++' it gives error there:
void main()
{
return;
}

 
Is this answer useful? Yes | No
May 15, 2008 07:49:14   #4  
Rajnikant_Jachak Member Since: May 2008   Contribution: 1    

RE: Write any small program that will compile in "C" but not in "C++"
typedef enum {read blue green}color;
void main() {
color a 1; // Error in C++
}

 
Is this answer useful? Yes | No


 
Go To Top


 Sponsored Links

 
About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape