C

C notes #

Pointers #

int x = 1, y = 2, z[10];
int *ip;     /* ip -> int*/

ip = &x;     /* ip -> x */
y = *ip;     /* y = 1 */
*ip = 0;     /* x = 0 */
ip = &z[0];  /* ip -> z[0]*/

При передаче в функцию, переменные копируются, поэтому для изменения данных во внешней функции нужно передавать указатели.

File open modes #

modedescriptionstarts…
r/rbopen for reading (The file must exist)beginning
w/wbopen for writing (creates file if it doesn’t exist). Deletes content and overwrites the file.beginning
a/abopen for appending (creates file if it doesn’t exist)end
r+/rb+/r+bopen for reading and writing (The file must exist)beginning
w+/wb+/w+bopen for reading and writing. If file exists deletes content and overwrites the file, otherwise creates an empty new filebeginning
a+/ab+/a+bopen for reading and writing (append if file exists)end