Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

C and C++ Question

Name: Anonymous 2008-10-09 18:17

Why must you declare functions twice?

Name: Anonymous 2008-10-10 10:31

Actually, in C, you only have to declare a function if its return value or one of its arguments is not a word-sized integer. That's a feature inherited from the B programming language (which had the word-sized integer as its only type), I guess for compatibility. That's also why if you don't specify the type of a variable it defaults to int.

Name: Anonymous 2008-10-10 16:02

>>17
$ cat > noproto.c
main() { return !printf("%d\n", times2(16)); }
times2(a) { return mul(a, 2); }
mul(a, b) { return a * b; }
$ gcc -w -o noproto noproto.c && ./noproto
32
$

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List