3 ms·
If you're being silly you don't need a lot of that: $ cat tmp.c main() { printf("%d\n", 3+4); } $ gcc -w -o tmp.out tmp.c && ./tmp.out
by jefftk 3y ago
If you're being silly you don't need a lot of that:
$ cat tmp.c
main() {
printf("%d\n", 3+4);
}
$ gcc -w -o tmp.out tmp.c && ./tmp.out
7
You can even do away with types entirely, as long as you're working with ints:
$ cat tmp.c
foo(x) {
return x+5;
}
bar() {
return 4;
}
main() {
printf("%d\n", foo(bar()));
}
$ gcc -w -o tmp.out tmp.c && ./tmp.out
9
Rarely a good idea, though!
- benj111 3y agoTrue, but then someone will pop up and announce UB! (This probably isn't ub though). Anyway, my main point was that c has more boilerplate. It's never 'a+b'. Second, printf is complicated, that's aimed more at the op though.