第九章完结

This commit is contained in:
lzy
2024-04-13 17:13:47 +08:00
parent 387681af20
commit 5dc779eb22
4 changed files with 205 additions and 0 deletions

36
Chapter9/test.c Normal file
View File

@@ -0,0 +1,36 @@
#include <stdio.h>
#include <stdlib.h>
// void func(int **p, int n)
// {
// *p = malloc(n);
// if (NULL == *p)
// exit(1);
// return;
// }
void *func(int *p, int n)
{
p = malloc(n);
if (NULL == p)
exit(1);
return p;
}
int main()
{
int num = 100;
int *p = NULL;
// func(&p, num);
p = func(p, num);
free(p);
exit(0);
}