Contents [0/3] |
: comparison to Java [1/3] |
: Java programmer gotchas [2/3] |
: Compilation [3/3] |
: comparison to Java [1/3] |
Similarities
i = i+1; i++; i--; i *= 2; +, -, *, /, %
<, >, <=, >=, ==, != &&, ||, &, |, !
if ( ) { } else { } while ( ) { } do { } while ( ); for(i=1; i <= 100; i++) { } switch ( ) {case 1: ... } continue; break;
Differences
: Java programmer gotchas [2/3] |
For loops
C Java int i; for(i = 0; i < 10; i++) ... for(int i = 0; i < 10; i++) ...
Array declarations:
C Java int a[]; int[] a;
Array size:
C Java ??? a.size;
Uninitialized variables; catch with -Wall compiler option
int main() { int i; sqrt(i); }
Error handling
: Compilation [3/3] |
$ gcc -o hello.i -E hello.c
$ gcc -o hello.s -S hello.c
$ gcc -o hello.o -c hello.c
Revised: 2007/04/05 17:41