3 ms·
It still isn't simple #! /Usr/bin/python Print(a+b) V #include <stdio.h> Int main (){ Printf("%i", a+b); Return 0; } And printf is basically a DSL, so it
by benj111 3y ago
It still isn't simple
#! /Usr/bin/python
Print(a+b)
V
#include <stdio.h>
Int main (){
Printf("%i", a+b);
Return 0;
}
And printf is basically a DSL, so it still isn't 'simple'
And this is assuming a+b fits into an integer
- jefftk 3y agoIf 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.