GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Interview Questions  >  Programming  >  C
Go To First  |  Previous Question  |  Next Question 
 C  |  Question 396 of 453    Print  
Is it possible to write a c program without semicolons?

  
Total Answers and Comments: 9 Last Update: September 10, 2008     Asked by: kamba 
  
 Sponsored Links

 
 Best Rated Answer
Submitted by: p22068
 
yes it is possible to write a C program without a semicolon.
Ex:
int main()
{
  if (printf("%d", Hello"))
  {
    // EMPTY
  }
}

Above answer was rated as good by the following members:
nikhil jain, sumitshining, phull.neha, meghs007
December 07, 2007 03:42:45   #1  
p22068 Member Since: December 2007   Contribution: 2    

RE: Is it possible to write a c program without semicolons?
yes it is possible to write a C program without a semicolon.
Ex:
int main()
{
if (printf(" d" Hello"))
{
// EMPTY
}
}

 
Is this answer useful? Yes | NoAnswer is useful 1   Answer is not useful 0Overall Rating: +1    
December 07, 2007 03:43:58   #2  
p22068 Member Since: December 2007   Contribution: 2    

RE: Is it possible to write a c program without semicolons?
OOOps sorry there is a typo.. Put printf("Hello") in the "if" condition
 
Is this answer useful? Yes | No
January 05, 2008 02:21:29   #3  
Susil Kumar Member Since: January 2008   Contribution: 11    

RE: Is it possible to write a c program without semicolons?

Yes It is possible.

Example:

#include<stdio.h>
main(){

if(0){
}else{

}


}




 
Is this answer useful? Yes | No
January 27, 2008 16:04:27   #4  
ajeet7171 Member Since: January 2008   Contribution: 2    

RE: Is it possible to write a c program without semicolons?

No


 
Is this answer useful? Yes | No
May 08, 2008 07:10:18   #5  
nikhil jain Member Since: May 2008   Contribution: 1    

RE:
yes it is possible
put printf() library function in while loop or in if condition.

 
Is this answer useful? Yes | NoAnswer is useful 1   Answer is not useful 0Overall Rating: +1    
May 12, 2008 10:04:26   #6  
gau_bhatnagar Member Since: December 2005   Contribution: 29    

RE: Is it possible to write a c program without semicolons?

If you use any statement in your program then you have to use semicolon. Otherwise it will a syntax error.


 
Is this answer useful? Yes | NoAnswer is useful 0   Answer is not useful 1Overall Rating: -1    
May 14, 2008 09:11:20   #7  
vijay.shc Member Since: May 2008   Contribution: 1    

RE: Is it possible to write a c program without semicolons?
yes it is possible
 
Is this answer useful? Yes | No
May 23, 2008 10:17:28   #8  
jintojos Member Since: May 2008   Contribution: 29    

RE: Is it possible to write a c program without semicolons?

// Program For Finding Squar Of A NUmber
#define Squar(x) (x*x)
void main()
{
while(!printf("Squar Of 2 Is d" Squar(2))){}
}

 
Is this answer useful? Yes | NoAnswer is useful 2   Answer is not useful 0Overall Rating: +2    
September 10, 2008 05:08:02   #9  
rashmi.mohanty Member Since: September 2008   Contribution: 8    

RE: Is it possible to write a c program without semicolons?
Addition of 2 no without using semicolon:

void main(){ while( !printf("sum value d" 10+20) ) { } }

or

void main(){ if( printf("sum value d" 10+20) ) { } }

or

void main(){ switch( printf("sum value d" 10+20) ) { } }

 
Is this answer useful? Yes | NoAnswer is useful 1   Answer is not useful 0Overall Rating: +1    


 
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