Trabalho 2

442 palavras 2 páginas
C Reference Card (ANSI)
Program Structure/Functions type fnc (type 1 ,. . . ) type name main() { declarations statements
}
type fnc (arg 1 ,. . . ) { declarations statements return value ;
}
/* */ main(int argc, char *argv[]) exit(arg )

function declarations external variable declarations main routine local variable declarations function definition local variable declarations

Constants

Flow of Control

long (suffix) float (suffix) exponential form octal (prefix zero) hexadecimal (prefix zero-ex) character constant (char, octal, hex) newline, cr, tab, backspace special characters string constant (ends with '\0')

L or l
F or f e 0
0x or 0X
'a', '\ooo ', '\xhh '
\n, \r, \t, \b
\\, \?, \', \"
"abc. . . de"

Pointers, Arrays & Structures

include library file
#include
include user file
#include "filename " replacement text
#define name text replacement macro
#define name (var ) text
Example . #define max(A,B) ((A)>(B) ? (A) : (B)) undefine #undef name quoted string in replace
#
concatenate args and rescan
##
conditional execution
#if, #else, #elif, #endif is name defined, not defined?
#ifdef, #ifndef name defined? defined(name ) line continuation char
\

declare pointer to type type *name declare function returning pointer to type type *f() declare pointer to function returning type type (*pf)() generic pointer type void * null pointer
NULL
object pointed to by pointer
*pointer
address of object name
&name
array name [dim ] multi-dim array name [dim 1 ][dim 2 ]. . .
Structures
struct tag { structure template declarations declaration of members
};
create structure struct tag name member of structure from template name .member member of pointed to structure pointer -> member
Example . (*p).x and p->x are the same single value, multiple type structure union bit field with b bits member : b

Data Types/Declarations

Operators (grouped by precedence)

comments main with args

Relacionados

  • Trabalho 2 2
    1571 palavras | 7 páginas
  • trabalho 2
    1103 palavras | 5 páginas
  • Trabalho 2
    386 palavras | 2 páginas
  • trabalho 2
    837 palavras | 4 páginas
  • Trabalho 2
    579 palavras | 3 páginas
  • TRABALHO 2
    732 palavras | 3 páginas
  • TRABALHO 2
    3099 palavras | 13 páginas
  • Trabalho 2
    799 palavras | 4 páginas
  • Trabalho 2
    909 palavras | 4 páginas
  • Trabalho 2
    1061 palavras | 5 páginas