Hi, My name is alfred and i'm going to show u my notes about array and pointers using c language
1. Pointer : variable that stores another variable's address.
Syntax : <type> *(pointer name);
2. Pointer can also store another pointer's address, it is called multi pointer, you just need to add more star.
Syntax : <type>**ptr_name;
3. Pointer will update the value of the integer/pointer if the integer/pointer is updated.
4. Array : same data type that is saved in certain slots/address but can be retrieved in any/random order.
Syntax : <type> Array_name[value_dimensional];
5. Array can be single dimensional or multi dimensional.
Syntax for 2D array : <type> Array_name[row][column];
Syntax for 3D array : <type> Array_name[row][column][depth];
6. Pointers can be combined with array.
Syntax : <type> *Array_name[single_dim];
7.String vs Char : Char is only a single variable stored in an array, while strings is an array of character that ended with '\0' or null.
8. Strings can be accessed with %s, char can be accessed with %c.
No comments:
Post a Comment