- This topic has 2 replies, 2 voices, and was last updated 16 years, 9 months ago by .
Viewing 2 reply threads
Viewing 2 reply threads
- The forum ‘C Programming’ is closed to new topics and replies.
Home › Forums › C Programming › with out semicolon
Can u write a ‘C’ program with out using semicolon ?
U should not use any macros…
I guess that depends on your definition of “a program”. You could just do this:
1 2 3 4 | void main()<br /> {<br /> <br /> } |
This is a do nothing program. The lack of semicolons rules out most expressions and declarations , ect. You could add an empty loop:
1 2 3 4 5 6 | while ( 1 )<br /> {}<br /> <br /> or<br /> while ( 0 )<br /> {} |
Heres a copy of the C grammar that you can check out to maybe find more:
http://www.lysator.liu.se/c/ANSI-C-grammar-y.html
Hes another:
1 2 3 4 5 6 7 8 | #include <stdio.h><br /> void main()<br /> {<br /> if ( printf ( "Hello world!n") )<br /> {}<br /> if ( printf ( "This is a program with no semicolonsn" ) )<br /> {}<br /> } |
I think you could build an entire program this way. Have to think about this!