Initial commit

This commit is contained in:
lzy
2024-03-10 16:11:35 +08:00
commit 0baf07a597
14 changed files with 132 additions and 0 deletions

BIN
Chapter1/Section2/hello Executable file

Binary file not shown.

16
Chapter1/Section2/hello.c Normal file
View File

@@ -0,0 +1,16 @@
#include <stdio.h>
#include <stdlib.h>
#if 0
void main(void);
void main(int argc, char **argv);// char *argv[]
int main(int argc, char **argv);
int main(void);
#endif
int main(void)
{
printf("Hello world!\n");
exit(0);
}

BIN
Chapter1/Section3/a Executable file

Binary file not shown.

18
Chapter1/Section3/a.c Normal file
View File

@@ -0,0 +1,18 @@
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
int main()
{
FILE *fp;
fp = fopen("tmp", "r");
if (fp == NULL)
{
fprintf(stderr, "fopen():%s\n", strerror(errno));
exit(1);
}
puts("ok!");
exit(0);
}

BIN
Chapter1/Section3/a.out Executable file

Binary file not shown.

BIN
Chapter1/Section3/hello Executable file

Binary file not shown.

12
Chapter1/Section3/hello.c Normal file
View File

@@ -0,0 +1,12 @@
#include <stdio.h>
int main(void)
{
int *p = NULL;
int i;
p = (int *)malloc(sizeof(int));
if (p == NULL)
return -1;
printf("Hello world!\n");
return 0;
}

BIN
Chapter1/Section3/return Executable file

Binary file not shown.

View File

@@ -0,0 +1,6 @@
#include <stdio.h>
int main(void)
{
printf("Hello world!\n");
}