改错参考答案:
(3)将字符串yy在屏幕上输出 #include
/*********Found************/ char yy[100] = \
/*********Found************/ f0r (; *yy; yy++) {
putchar(*yy); } }
#include
/*********Found************/ char *yy=\
/*********Found************/ for (; *yy; yy++) {
putchar(*yy); } }
(4)计算半径为2+3的圆的面积 #include
/*********Found************/ #define S(r) PI*r*r void main() {
/*********Found************/ int mianJi;
mianJi = S(2+3);
printf(\}
#include
/*********Found************/ #define S(r) PI*(r)*(r) void main() {
/*********Found************/ float mianJi; mianJi = S(2+3);
printf(\}
(8)打开文件d:\\te.c用于读并判断打开是否成功 #include
FILE *fp;
/*********Found************/ char fileName[] = \
/*********Found************/ fp = fopen(fileName, \
/*********Found************/ if (fp == EOF) {
puts(\ exit(1); }
putchar(fgetc(fp)); fclose(fp); }
#include
FILE *fp;
/*********Found************/ char fileName[] = \
/*********Found************/ fp = fopen(fileName, \
/*********Found************/ if (fp == NULL) {
puts(\ exit(1); }
putchar(fgetc(fp)); fclose(fp); }
(9)申请100个字节的内存空间,显示其首地址,然后释放申请到的内存空间 #include
{
/*********Found************/ char p[100];
/*********Found************/ if (p = (char *)malloc(100) == NULL) {
printf(\ return ; }
printf(\
/*********Found************/ fclose(p); }
#include
/*********Found************/ char *p;
/*********Found************/ if ((p = (char *)malloc(100)) == NULL) {
printf(\ exit(1); }
printf(\
/*********Found************/ free(p); }
(10)将字符串p显示在屏幕上 #include
/*********Found************/ #define BEGIN
/*********Found************/ #define END void main() {
char *p = \ const int i = 0;
for (printf(\ BEGIN
putchar(p[i]);
/*********Found************/ i++;