- The C language is considered "The mother language" of modern programming languages.When you learn C++,Java, PHP, C# or Javascript, you'll find that learning programming through C helps you quickly grapsp these other programming language.This is because the syntax and concepts of C are very similar to those of these popular programming languages.While you don't necessarily have to start with the C programming language, from my experience, beginning your programming journey with C or C++ is still the optional choice.
- int: (So nguyen).
- float: (So thuc).
- double: (So thuc do chinh xac cao).
- char: (ky tu).
- array: (Mang).
- pointer: (con tro).
- structure: (Cau truc).
- union: (Lop).
- enum: (Liet ke).
To increase the value of a variable by 1, you can the ++ operator, or to decrease the value by 1, use can the -- operator.
- ++a: increase first (Tang truoc).
- a++: increase after (tang sau).
- --a: decrease first (giam truoc).
- a--: decrease after (giam sau).
Bitwise operators are a set of operators and funcions speciffically designed to perform transfomation and calculation operation on the bits of an integer (such as int or long long C++).
-
Syntax: [Comparation Expression] ? [Return value 1] ? [Return value 2] .
-
Meaning: The first part of this operator will evaluate to either true or false.If part evaluate to true, the expression will return value 1, otherwise, if this part evaluates to false, the expression will return value 2.
Example: int n = 10 < 20 ? 100 : 200;
- In this case, n will have the value of 100, because 10 < 20 evaluates to true, so n assigned the value of 100 instead of 200.
- if, else, else if, switch, case, default.
- for, while, do-while.
- break: (Thoat vong lap)
- continue: (bo qua vong hien tai)
- return: (tra ve)
- goto: (nhay den nhan chi dinh)
- Void Function (does not return a value).
- Function that returns value (int, float, etc..).
- Function with parameters and without parameters.
- stdio.h: (I/O: printf, scanf).
- stdlib.h: (ham chung: malloc, free, exit).
- string.h: (chuoi: strlen, strcpy, strcat).
- math.h: (Toan hoc: sqrt, pow, sin, cos,...).
- ctype.h: (kiem tra ky tu isalpha, isdigit).
- time.h: (Thao tac voi thoi gian: time, localtime, strftime,... ).
- assert.h: (Kiem tra dieu khien in ra loi: assert).
- errno.h: (cung cap bien error luu tru ma loi, xu ly loi).
- malloc: (dynamic memory allocation).
- calloc: (dynamic memory allocation and initialization).
- realloc: (resize allocated memory).
- free: (release memory).
- Null Pointer: null.
- Dangling Pointer: (invalid pointer).
In C, to store a string of characters, you use a char array.There are vairous terms used to refer to a character array:character string, character array, or string.
- strlen: (do dai chuoi)
- strcpy: (sao chep chuoi)
- strcat: (noi chuoi)
- strcmp: (so sanh chuoi)
- "r": read (file must exist)
- "w": write (create or truncates file)
- "a": read (writes to end, create if not exists)
- "rb":read (file must exist)
- "wb" :Write binary (creates or truncates file)
- "ab": Append binary (writes to end, creates if not exists)
- "r+": Read and write (file must exist)
- "w+": Read and write (creates or truncates file)
- "a+": Read and append (reads from start, writes to end)
- "rb+": Read and write binary (file must exist)
- "wb+": Read and write binary (creates or truncates file)
- "ab+": Read and append binary (reads from start, writes to end)
- Function perror: (in ra loi)
- errno: (bien luu ma loi)
-
Allocates specified bytes of memory.
-
Syntax: void* malloc(size_t size);
- Deallocates previously allocated memory.
- Syntax: void free(void* ptr);
- Allocates memory for an array and initializes all bytes to zero.
- Syntax: void* calloc(size_t num, size_t size);
- define PI 3.14 (định nghĩa hằng số)
- define SQUARE(x) (x * x) (định nghĩa macro hàm)
- #include, #define, #ifdef, #ifndef, #endif, #pragma
- exit(0): thoat chuong trinh
- exit(1): thoat chuong trinh loi
- Use system ("command") de chay chuong trinh