Line | |
---|
1 | #include <mr_mem.h>
|
---|
2 | #include <stdio.h>
|
---|
3 | #include <stdlib.h>
|
---|
4 | #include <assert.h>
|
---|
5 |
|
---|
6 | void is_null(const char* str)
|
---|
7 | {
|
---|
8 | if (str == NULL)
|
---|
9 | printf("pointer is null\n");
|
---|
10 | else
|
---|
11 | printf("pointer is NOT null\n");
|
---|
12 | }
|
---|
13 |
|
---|
14 | int main(void)
|
---|
15 | {
|
---|
16 | char* str = NULL;
|
---|
17 |
|
---|
18 | printf("*** Test with mr_free\n");
|
---|
19 | str = mr_malloc(10);
|
---|
20 | is_null(str);
|
---|
21 | mr_free(str);
|
---|
22 | is_null(str);
|
---|
23 |
|
---|
24 | printf("*** Test with NULL\n");
|
---|
25 | str = NULL;
|
---|
26 | is_null(str);
|
---|
27 | mr_free(str);
|
---|
28 | is_null(str);
|
---|
29 |
|
---|
30 | return 0;
|
---|
31 | }
|
---|
32 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.