2023-12-20 初识

Last login: Tue Dec 19 09:16:09 2023 from 192.168.23.1

[root@localhost ~]# ls

anaconda-ks.cfg  democ01.c  democ02.c  Documents        Pictures  Videos

a.out            democ01.h  democ02.h  Downloads        Public

a.txt            democ01.o  democo2.h  Music            temp

biaoc            democ01pro  Desktop    original-ks.cfg  Templates

[root@localhost ~]# democ01pro

bash: democ01pro: command not found...

[root@localhost ~]# vi democ03.c

[root@localhost ~]# gcc democ03.c

democ03.c: In function ‘main’:

democ03.c:6:11: error: ‘val’ undeclared (first use in this function)

  int val3=val+6;

          ^

democ03.c:6:11: note: each undeclared identifier is reported only once for each function it appears in

[root@localhost ~]# vi democ03

[root@localhost ~]# vi democ03.c

[root@localhost ~]# gcc democ03.c

democ03.c: In function ‘main’:

democ03.c:7:11: error: ‘val’ undeclared (first use in this function)

  int val3=val+6;

          ^

democ03.c:7:11: note: each undeclared identifier is reported only once for each function it appears in

[root@localhost ~]# vi democ03.c

[root@localhost ~]# vi democ03.c

[root@localhost ~]# gcc democ03.c

[root@localhost ~]# ls

anaconda-ks.cfg  democ01.c  democ02.c  Desktop    original-ks.cfg  Templates

a.out            democ01.h  democ02.h  Documents  Pictures        Videos

a.txt            democ01.o  democ03.c  Downloads  Public

biaoc            democ01pro  democo2.h  Music      temp

[root@localhost ~]# ./a.out

val1=20

val2=3

val3=6

[root@localhost ~]# vi democ.03

[root@localhost ~]# vi democ03.c

[root@localhost ~]# gcc democ03.c

[root@localhost ~]# ./a/out

-bash: ./a/out: No such file or directory

[root@localhost ~]# ls

anaconda-ks.cfg  democ01.c  democ02.c  Desktop    original-ks.cfg  Templates

a.out            democ01.h  democ02.h  Documents  Pictures        Videos

a.txt            democ01.o  democ03.c  Downloads  Public

biaoc            democ01pro  democo2.h  Music      temp

[root@localhost ~]# ./a.out

val1=20

val2=3

val3=6

赋值后:val1=3

val2=6

val3=3

[root@localhost ~]# vi democ04.c

[root@localhost ~]# gcc demov04.c

gcc: error: demov04.c: No such file or directory

gcc: fatal error: no input files

compilation terminated.

[root@localhost ~]# gcc democ04.c

democ04.c: In function ‘main’:

democ04.c:9:2: error: expected ‘;’ before ‘printf’

  printf("\n");

  ^

democ04.c:11:2: error: expected ‘;’ before ‘return’

  return 0;

  ^

[root@localhost ~]# vi democ04.c

[root@localhost ~]# gcc democ04.c

[root@localhost ~]# ./a.out

val1=0

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容