Please enable JavaScript.
Coggle requires JavaScript to display documents.
C (:fire:declaration VS definition (int x = 1;
int x = 2; (global scope:…
C
-
keywords
:star:static
- header file: static int x = 1;
- source file: static int x = 2;
-
- header file: // nothing
- source file: static int x = 2;
-
- header file: static int x;
- source file: static int x = 2;
-
Others
int main(void){
static int x = 5;
{
static int x = 2;
printf("%d", x); // x = 2
}
}
-
-
-
enum
enumerator CANNOT be same
E.g. enum day {Monday, Monday} will cause error
-
:warning:enum x {a = 1, b = a + 1};
=> b = 2
-
Misc
-
-
-
WHILE
:warning:
while (i < 5, j < 10)
equals
while ((i < 5) || (j < 10))
:explode: Notes
-
Common mistakes
ERROR when:
- Provide storage class for parameter
E.g. int foo(auto int x);
The same error for STATIC, REGISTER keyword
others
-
"break", "continue" cannot use in IF condition
-