쉽게 풀어쓴 C언어 express 12장 연습문제
1(1).#include int equal(struct point p1, struct point p2);struct point {int x, y;}; int main(){struct point p1;struct point p2;printf("첫번째x와y의값을입력하시오:");scanf("%d %d", &p1.x, &p1.y);printf("두번째x와y의값을입력하시오:");scanf("%d %d", &p2.x, &p2.y);printf("일치여부(1이면일치, 0이면불일치):%d\n", equal(p1, p2));}int equal(struct point p1, struct point p2) {if (p1.x == p2.x&&p1.y == p2.y)return 1;elsereturn 0;} 1(2).#incl..
2016. 9. 25.
쉽게 풀어쓴 C언어 express 11장 연습문제
1.#include int main(){int x = 0x12345678;unsigned char *xp = (char*)&x;//x의배열주소를char형으로*xp포인터로넘김printf("바이트순서:%x %x %x %x\n", xp[0], xp[1], xp[2], xp[3]);//각각배열을출력return 0;} 2.#include void get_sum_diff(int x, int y, int *p_sum, int *p_diff){*p_sum = x + y*p_diff = x - yreturn 0;}int main(){int x, y;printf("x와y의값을입력하시오:");scanf("%d %d", &x, &y);get_sum_diff(x, y,&x,&y);printf("합: %d\n차: %d\n", x..
2016. 9. 25.
쉽게 풀어쓴 C언어 express 10장 연습문제
1번#include int main(){int day[12] = { 31,29,31,30,31,30,31,31,30,31,30,31 };int i;for (i = 1; i max)max = x[i];}printf..
2016. 9. 25.