목록전체 글 (313)
printf("ho_tari\n");
#include int add(int a, int b) { return a + b; } int substract(int a, int b) { return a - b; } int main(void) { int (*fp)(int, int); fp = &add; int re = (*fp)(4, 3); printf("re: %d\n", re); fp = &substract; re = (*fp)(4, 3); printf("re: %d\n", re); return 0; }
#include int main(void) { int a; int *pa; int **ppa; a = 100; pa = &a; ppa = &pa; **ppa = 200; printf("a: %d\n", a); return 0; }
#include int main(void) { int a = 0x12345678; //int *p; char *p; p = (char*)&a; printf("*p : 0x%x\n", *p); return 0; }
#include int main(void) { int i; int nums[5]; int *p; //p = &i; p = &nums[1]; *p = 100; printf("*p : %d\n", *p); return 0; }
#include int main(void) { int a; int *p; a = 100; p = &a; *p = 200; printf("a: %d\n", a); return 0; }
#include int main(void) { int score; printf("input score : "); scanf("%d", &score); int isPass = (score >= 60); printf("score : %d - pass : %d\n", score, isPass); return 0; } #include int main(void) { int score; printf("input score : "); scanf("%d", &score); //int isPass = (score >= 60); //printf("score : %d - pass : %d\n", score, isPass); if (score >= 60) { printf("score : %d --- pass\n", score..
#include int main(void) { int year; scanf("%d", &year); //int isLeap = (year % 4 == 0 && year % 100 != 0 || year % 400 == 0); //int isLeap = (year % 400 == 0 || year % 4 == 0 && year % 100 != 0); //printf("%d is leap : %d\n", year, isLeap); if (year % 4 == 0 && year % 100 != 0 || year % 400 == 0) { printf("%d is a leap year\n", year); } else { printf("%d is an ordinary year\n", year); } return 0..