본문 바로가기
IT/프로그래밍

쉽게 풀어 쓴 C언어 Express 16장 Exercise 문제

by nutrient 2020. 12. 7.
728x90
728x170

쉽게 풀어 쓴 C언어 Express 16장 Exercise 문제

 

1. (4)

 

2.

(1) fflush()

(2) fgets()

(3) feof()

(4) fscanf()

 

3. (3)

4.

(a)

int i;

scanf("%d", i);

->

int i;

scanf("%d", &i);

 

(b)

double d;

scanf("%f", &d);

-> 

double d;

scanf("%lf", &d);

 

(c)

char s[10];

scanf("%c", s[2]);

->

char s[10];

scanf("%c", &s[2]);

 

(d)

float f;

scanf("%d", &f);

->

float f;

scanf("%f", &f);

 

5.

(a) afp = fopen("junk.txt", "a");

(b) pfp = fopen("para.txt", "w+");

(c) bfp = fopen("company.dat", "rb");

 

6. (4)

 

7. (4)

 

8. getchar()

 

9. (2)

 

10.

#include <stdio.h>

struct test {

int a;

float b;

}

record;

int main(void) {

FILE *fp=fopen("TEST.DAT", "rb");

fread(&record, sizeof(record), 1, fp);

fclose(fp);

return 0;

}

 

11.

i = 8

728x90
그리드형

댓글