This is my own library for Data structure and Algorithm Language: C
- After clone this repository, jump into directory Algorithm by
cd Algorithm
- Then type:
make
cd ../TestAlgo
make
./test
Do the same but instead of Algorithm, jump into DataStructure folder and type make
,
then jump to TestData/List (or Stack or Queue) type make
. Finally type ./test
- By typing make, you will run the default command in
makefile
. - For library, ex: Algorithm, make will build a library *.a, copy to Implementation and copy the header files to Header.
- In the root directory,
make
will compile test.c with all including library into an executable file test.
- Pointer is address, it point to address of 1 variable
- Only assign value to the value of pointer (*p) after allocation
*p = (int *)malloc(sizeof(int));
or you could just:p = &a;
- Otherwise, error will occur (segmentation fault- core dumpted).
- Pass pointer to a function, inside that function, change the value, after the function finished, value is changed.
- Pass pointer to a function, inside that function, change address of the pointer, after function finished, nothing is changed. To change address of pointer passed to a function, use pointer to pointer
**
.
- An
Uninitialized pointer
will point to a random location: like0x7ffe56f3d930
, sometimes it =NULL
- A
NULL pointer
will exactly point to location with the name:(nil)
.