A Quick Reference to C Programming Language
A Quick Reference to C Programming Language
Structure of a C Program #include(stdio.h) #include... #define..
/* Declare global variables*/) (variable type)(variable list);
/* include IO library */ /* include other files */ /* define constants */
/* Define program functions */ (type returned)(function name)(parameter list) (declaration of parameter types) {
(declaration of local variables); (body of function code); } /* Define main function*/ main ((optional argc and argv arguments)) (optional declaration parameters) { (declaration of local variables); (body of main function code); }
Comments
Format: Example:
/*(body of comment)
*/
/*This is a comment in C*/
Constant Declarations
Format: Example:
#define(constant name)(constant value) #define MAXIMUM 1000
Type Definitions
Format: Example:
Variables Declarations: Format: Example:
typedef(datatype)(symbolic name); typedef int KILOGRAMS;
(variable type)(name 1)(name 2),...; int firstnum, secondnum;
Initializing: Format: Example:
Assignments: Format: Example:
Unions Declarations: Format:
Example:
Assignment: Format:
Structures Declarations: Format:
Example:
char alpha; int firstarray[10]; int doublearray[2][5]; char firststring[1O];
(variable type)(name)=(value); int firstnum=5;
(name)=(value); firstnum=5; Alpha='a';
union(tag) {(type)(member name);
(type)(member name); ...
}(variable name); union demotagname {int a;
float b; }demovarname;
(tag).(member name)=(value); demovarname.a=1; demovarname.b=4.6;
struct(tag) {(type)(variable);
(type)(variable); ...
}(variable list); struct student {int idnum;
int finalgrade; char lettergrade; } first,second,third;
Assignment: Format: Example:
(variable name).(member)=(value); first.idnum=333; second.finalgrade=92;
Operators Symbol +,-,*,/ % > >= < > ................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related download
- a quick reference to c programming language
- introduction to c
- the c cheat sheet university of alberta
- the java language cheat sheet if statements
- chapter 6 data type
- quick and dirty guide to c university of washington
- introduction to the java programming language
- tutorial programming in java for android development
- the c language reference manual
- formatted and unformatted input and output i o in c