c语言程序解读

Python014

c语言程序解读,第1张

#include<stdio.h>

main() {

int i,n

char *pa,*s

pa="Happy"//pa指向字符首地址

for(s=pa,n=0*s++s,++n)//测出字符串的串长为n

for(s=pa,i=0i<nputchar(*s++),++i) //按字符输出字符串中的字符

}

程序运行后,输出为:

Happy

main()

{

int

i=0

//定义整型变量i,初值为0

char

c

//定义字符型变量c

while(1)

//

判断为条件为真时执行下面的

{

c='\0'

//c赋值'\0'

while(c!=13&&c!=27)

//当条件c不等于13同时c不等于27时执行下面的

{

c=getch()

//调用getch()函数,并把值赋c

printf("%c\n",c)

//打印

c的值

}

if(c==27)

//当条件c等于27

break

//返回

i++

//i的自加1

printf("the

no.is%d\n",i)

//输出为the

no.is空行,打印

i的值

}

printf("the

end")

//打印

the

end字符串

getch()

//调用getch()

}