+ 10
How to code to print"hello world" without semicolon in C ?
11 odpowiedzi
+ 11
#include <stdio.h>
int main() {
if(printf("Hello World"))
return 0;
}
+ 7
if (printf("Hello world!")) {}
+ 3
#include<stdio.h>
void main(){
if(printf("hello world")){}
}
+ 3
Shikha main also returns a number at the end, default 0, to indicate success. You can use return 1; (or any other number other then 0) to indicate an error and end the program. Which in C, with all the many segmentation faults that are possible, is very helpful.
HonFu okay I thought so, just for fun then.
+ 2
Why we only use main function to start the program?
+ 1
When you want to end a state in a line and go to the next line you should put semicolon at the end of the line.[in C you should put semicolons at the end of every lines(except after curly braces and loop statements)]
+ 1
In C, any void returning statement is true. You could try that.
+ 1
Just curious, is there a reason this is useful?
+ 1
Not really I think. 😏