Programacion

Solo disponible en BuenasTareas
  • Páginas : 3 (581 palabras )
  • Descarga(s) : 0
  • Publicado : 11 de septiembre de 2012
Leer documento completo
Vista previa del texto
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
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 orl F or f e 0 0x or 0X 'a', '\ooo', '\xhh' \n, \r, \t, \b \\, \?, \', \" "abc. . . de"

Flow of Control
statement terminator ; block delimeters { } exit from switch, while, do, for break nextiteration of while, do, for continue go to goto label label label : return value from function return expr Flow Constructions if statement if (expr ) statement else if (expr ) statement else statementwhile statement while (expr ) statement for statement for (expr 1 ; expr 2 ; expr 3 ) statement do statement do statement while(expr ); switch statement switch (expr ) { case const 1 : statement 1 break;case const 2 : statement 2 break; default: statement }

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

comments main with args terminate execution

C Preprocessor...
tracking img