본 강의에 들어가기 전

Size: px
Start display at page:

Download "본 강의에 들어가기 전"

Transcription

1 C 기초특강 종합과제

2 과제내용 구조체를이용하여교과목이름과코드를파일로부터입력받아관리 구조체를이용하여학생들의이름, 학번과이수한교과목의코드와점수를파일로부터입력 학생개인별총점, 평균계산 교과목별이수학생수, 총점및평균을계산 결과를파일에저장하는프로그램을작성 2

3 Makefile OBJS = score_main.o score_input.o score_calc.o score_print.o score_util.o CC = gcc score : score.h $(OBJS) $(CC) -o score $(OBJS) score_main.o : score.h score_main.c score_util.o : score.h score_util.c score_input.o : score.h score_input.c score_calc.o : score.h score_calc.c score_print.o : score.h score_print.c test1 : test1.o score_input.o score_util.o gcc -o test1 test1.o score_input.o score_util.o test2 : test2.o score_input.o score_util.o gcc -o test2 test2.o score_input.o score_util.o test3 : test3.o score_input.o score_util.o score_print.o score_calc.o gcc -o test3 test3.o score_input.o score_util.o score_print.o score_calc.o clean : rm $(OBJS) score rebuild : make clean make score 3

4 score.h (1) 1 #ifndef _SCORE_H 2 #define _SCORE_H 3 4 #include <stdio.h> 5 6 #define MAX_CLASS_SIZE #define MAX_SUBJECTS 50 8 #define MAX_SUBJECTS_PER_STD #define LINE_SIZE #define SUB_NAME_SIZE #define STD_NAME_SIZE #define STD_ID_SIZE typedef struct { 16 char name[sub_name_size]; 17 int sub_code; 18 int scored_std_no; 19 int total_std_score; 20 } subject_t; typedef struct { 23 int sub_code; 24 int score; 25 } sub_score_t; typedef struct { 28 char std_name[std_name_size]; 29 char std_id[std_id_size]; 30 sub_score_t sub_scores[max_subjects_per_std]; 31 int subjects_no; 32 int total_score; 33 double average; 34 } score_t; 4

5 score.h (2) 36 int is_dup_sub(subject_t subjects[], int target); 37 int sub_code_to_index(subject_t subjects[], int table_size, int sub_code); 38 int is_valid_sub_code(subject_t subjects[], int table_size, int sub_code); int fget_subjects(file *inflie, subject_t subjects[]); 41 int fget_std_scores(file *infile, score_t scores[], 42 subject_t subjects[], int sub_table_size); void calc_personal_total_avg(score_t scores[], int table_size); 45 void calc_class_total_avg(score_t scores[], int table_size, 46 subject_t subjects[], int subjects_no, 47 int *total_all, double *average_all); void fput_std_scores(file *outfile, score_t scores[], int table_size, 50 subject_t subjects[], int sub_table_size); 51 void fput_sub_summary(file *outfile, subject_t subjects[], int table_size); #endif 5

6 test1.c 1 #include "score.h" 2 3 main() 4 { 5 FILE *ifile; 6 subject_t subjects[max_subjects] = {0}; 7 int subjects_no; 8 int i; 9 10 ifile = fopen("subject_data", "r"); 11 subjects_no = fget_subjects(ifile, subjects); 12 fclose(ifile); for (i = 0; i < subjects_no; i++) { 15 printf("%s %d\n", subjects[i].name, subjects[i].sub_code); 16 } 17 } 6

7 test2.c 1 #include "score.h" 2 3 main() 4 { 5 FILE *ifile; 6 subject_t subjects[max_subjects] = {0}; 7 score_t scores[max_class_size] = {0}; 8 int subjects_no; 9 int students_no; 10 int i; 11 int j; ifile = fopen("subject_data", "r"); 14 subjects_no = fget_subjects(ifile, subjects); 15 fclose(ifile); for (i = 0; i < subjects_no; i++) { 18 printf("%s %d\n", subjects[i].name, subjects[i].sub_code); 19 } ifile = fopen("score_data", "r"); 22 students_no = fget_std_scores(ifile, scores, subjects, subjects_no); 23 fclose(ifile); for (i = 0; i < students_no; i++) { 26 printf("%s %s %d ", scores[i].std_name, scores[i].std_id, scores[i].subjects_no); 27 for (j = 0; j < scores[i].subjects_no; j++) { 28 printf("%d %d ", scores[i].sub_scores[j].sub_code, 29 scores[i].sub_scores[j].score); 30 } 31 printf("\n"); 32 } 33 } 7

8 test3.c 1 #include "score.h" 2 3 main() 4 { 5 FILE *ifile; 6 subject_t subjects[max_subjects] = {0}; 7 score_t scores[max_class_size] = {0}; 8 int subjects_no; 9 int students_no; 10 int total_score; 11 double total_avg; 12 int i; 13 int j; ifile = fopen("subject_data", "r"); 16 subjects_no = fget_subjects(ifile, subjects); 17 fclose(ifile); for (i = 0; i < subjects_no; i++) { 20 printf("%-20s %d\n", 21 subjects[i].name, subjects[i].sub_code); 22 } ifile = fopen("score_data", "r"); 25 students_no = fget_std_scores(ifile, 26 scores, subjects, subjects_no); 27 fclose(ifile); 28 calc_personal_total_avg(scores, students_no); 29 calc_class_total_avg(scores, students_no, subjects, 30 subjects_no, &total_score, &total_avg); 31 fput_std_scores(stdout, scores, students_no, 32 subjects, subjects_no); 33 fput_sub_summary(stdout, subjects, subjects_no); 34 } 8

9 score_main.c (1) 1 #include "score.h" 2 #include <stdlib.h> 3 4 main() 5 { 6 FILE *ifile; 7 subject_t subjects[max_subjects] = {0}; 8 score_t scores[max_class_size] = {0}; 9 int subjects_no; 10 int students_no; 11 int total_score; 12 double total_avg; ifile = fopen("subject_data", "r"); 15 if (ifile) { 16 subjects_no = fget_subjects(ifile, subjects); 17 fclose(ifile); ifile = fopen("score_data", "r"); 20 if (ifile) { 21 students_no = fget_std_scores(ifile, scores, subjects, subjects_no); 22 fclose(ifile); calc_personal_total_avg(scores, students_no); 25 calc_class_total_avg(scores, students_no, 26 subjects, subjects_no, &total_score, &total_avg); fput_std_scores(stdout, scores, students_no, subjects, subjects_no); 29 fput_sub_summary(stdout, subjects, subjects_no); 30 } 9

10 score_main.c (2) 31 else { 32 fprintf(stderr, "Error in fopen!\n"); 33 exit(2); 34 } 35 } 36 else { 37 fprintf(stderr, "Error in fopen!\n"); 38 exit(1); 39 } 40 } 10

11 score_util.c (1) 1 #include "score.h" 2 3 /******************************************************************************/ 4 int is_dup_sub(subject_t subjects[], int target) 5 { 6 int i; 7 8 for (i = 0; i < target; i++) { 9 if (!strncmp(subjects[i].name, 10 subjects[target].name, 11 SUB_NAME_SIZE) 12 (subjects[i].sub_code 13 == subjects[target].sub_code)) 14 return 1; 15 } 16 return 0; 17 } 18 11

12 score_util.c (2) 19 /******************************************************************************/ 20 int sub_code_to_index(subject_t subjects[], int table_size, int target) 21 { 22 int i; for (i = 0; i < table_size; i++) { 25 if (subjects[i].sub_code == target) 26 return i; 27 } 28 return -1; 29 } /******************************************************************************/ 32 int is_valid_sub_code(subject_t subjects[], int table_size, int target) 33 { 34 if (sub_code_to_index(subjects, table_size, target) >= 0) 35 return 1; 36 else 37 return 0; 38 } 12

13 score_input.c (1) 1 #include "score.h" 2 #include <string.h> 3 4 /******************************************************************************/ 5 int fget_subjects(file* infile, subject_t subjects[]) 6 { 7 int i; 8 char line[line_size]; 9 int line_no = 0; for (i = 0; i < MAX_SUBJECTS; i++) { 12 if (fgets(line, LINE_SIZE, infile)) { 13 ++line_no; if (sscanf(line, "%s %d", 16 &subjects[i].name, 17 &subjects[i].sub_code)!= 2) { 18 return i; 19 } 20 else { 21 if (is_dup_sub(subjects, i)) { 22 fprintf(stderr, 23 "\nduplicated sub_code or sub_name in line %d!\n", 24 line_no); 25 i--; 26 } 27 } 28 } 29 else { 30 return i; 31 } 32 } 33 return i; 34 } 13

14 score_input.c (2) 36 /******************************************************************************/ 37 int fget_std_scores(file* infile, score_t scores[], subject_t subjects[], int sub_table_size) 38 { 39 int i; 40 int j; 41 char line[line_size]; 42 char *tmp; 43 int read_char_cnt; 44 int final_pos; for (i = 0; i < MAX_CLASS_SIZE; i++) { 47 memset(line, 0, LINE_SIZE); 48 if (fgets(line, LINE_SIZE, infile)) { 49 tmp = line; 50 final_pos = strlen(line); if (sscanf(tmp, "%s %s%n", 53 &scores[i].std_name, 54 &scores[i].std_id, 55 &read_char_cnt)!= 2) { 56 return i; 57 } 14

15 score_input.c (3) 58 else { 59 tmp += read_char_cnt; 60 for (j = 0; (j < MAX_SUBJECTS_PER_STD) && (tmp < line + final_pos); j++) { 61 if (sscanf(tmp, "%d %d%n", 62 &scores[i].sub_scores[j].sub_code, 63 &scores[i].sub_scores[j].score, 64 &read_char_cnt) == 2) { 65 tmp += read_char_cnt; 66 if (!is_valid_sub_code(subjects, 67 sub_table_size, 68 scores[i].sub_scores[j].sub_code) 69 (scores[i].sub_scores[j].score < 0) 70 (scores[i].sub_scores[j].score > 100)) { 71 fprintf(stderr, "Invalid data in scores[%d]\n", i); 72 j--; 73 } 74 } 75 else { 76 break; 77 } 78 } 79 scores[i].subjects_no = j; 80 } 81 } 82 else { 83 return i; 84 } 85 } 86 return i; 87 } 15

16 score_calc.c (1) 1 #include "score.h" 2 3 /******************************************************************************/ 4 void calc_personal_total_avg(score_t scores[], int table_size) 5 { 6 int i; 7 int j; 8 9 for (i = 0; i < table_size; i++) { 10 scores[i].total_score = 0; 11 if (scores[i].subjects_no > 0) { 12 for (j = 0; j < scores[i].subjects_no; j++) 13 scores[i].total_score += scores[i].sub_scores[j].score; scores[i].average = (double)scores[i].total_score / scores[i].subjects_no; 16 } 17 else { 18 scores[i].average = 0.; 19 } 20 } 21 } 16

17 score_calc.c (2) 23 /******************************************************************************/ 24 void calc_class_total_avg(score_t scores[], int table_size, 25 subject_t subjects[], int subjects_no, 26 int *total_all, double *average_all) 27 { 28 int i; 29 int j; 30 int sub_index; *total_all = 0; 33 *average_all = 0.; for (i = 0; i < table_size; i++) { 36 *total_all += scores[i].total_score; for (j = 0; j < scores[i].subjects_no; j++) { 39 sub_index = sub_code_to_index(subjects, subjects_no, 40 scores[i].sub_scores[j].sub_code); 41 if (sub_index >= 0) { 42 subjects[sub_index].scored_std_no++; 43 subjects[sub_index].total_std_score 44 += scores[i].sub_scores[j].score; 45 } 46 else { 47 fprintf(stderr, "Invalid subject code in scores[%d]!\n", i); 48 } 49 } 50 } 51 } 17

18 score_print.c (1) 1 #include "score.h" 2 3 /******************************************************************************/ 4 void fput_std_scores(file *outfile, score_t scores[], int table_size, 5 subject_t subjects[], int sub_table_size) 6 { 7 int i; 8 int j; 9 int sub_index; if (table_size > 0) { 12 fprintf(outfile, "Class Score Table\n\n"); for (i = 0; i < table_size; i++) { 15 if (scores[i].subjects_no > 0) { 16 fprintf(outfile, "%-20s %-20s ", 17 scores[i].std_name, scores[i].std_id); 18 fprintf(outfile, "%4d / %d = %.2f\t", 19 scores[i].total_score, 20 scores[i].subjects_no, 21 scores[i].average); for (j = 0; j < scores[i].subjects_no; j++) { 24 sub_index = sub_code_to_index(subjects, 25 sub_table_size, 26 scores[i].sub_scores[j].sub_code); if (sub_index >= 0) { 29 fprintf(outfile, "%-20s %4d ", 30 subjects[sub_index].name, 31 scores[i].sub_scores[j].score); 32 } 33 } 34 fprintf(outfile, "\n"); 35 } 36 } 37 } 38 } 18

19 score_print.c (2) 40 /******************************************************************************/ 41 void fput_sub_summary(file *outfile, subject_t subjects[], int table_size) 42 { 43 int i; if (table_size > 0) { 46 fprintf(outfile, "\nsubjects Summary\n\n"); for (i = 0; i < table_size; i++) { 49 if (subjects[i].scored_std_no > 0) { 50 fprintf(outfile, "%-20s %6d %4d / %2d = %.2f\n", 51 subjects[i].name, 52 subjects[i].sub_code, 53 subjects[i].total_std_score, 54 subjects[i].scored_std_no, 55 (double) subjects[i].total_std_score 56 / subjects[i].scored_std_no); 57 } 58 } 59 } 60 } 19

20 subject_data 1 전산개론 C프로그래밍 DataBase 기초프로그래밍 1102 관련데이터파일 score_data 1 홍길동 이몽룡 김기영 김철수 안현수

untitled

untitled if( ) ; if( sales > 2000 ) bonus = 200; if( score >= 60 ) printf(".\n"); if( height >= 130 && age >= 10 ) printf(".\n"); if ( temperature < 0 ) printf(".\n"); // printf(" %.\n \n", temperature); // if(

More information

K&R2 Reference Manual 번역본

K&R2 Reference Manual 번역본 typewriter structunion struct union if-else if if else if if else if if if if else else ; auto register static extern typedef void char short int long float double signed unsigned const volatile { } struct

More information

1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 #define _CRT_SECURE_NO_WARNINGS #include #include main() { char ch; printf(" 문자 1개를입력하시오 : "); scanf("%c", &ch); if (isalpha(ch))

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 Network Programming Jo, Heeseung Network 실습 네트워크프로그래밍 멀리떨어져있는호스트들이서로데이터를주고받을수있도록프로그램을구현하는것 파일과는달리데이터를주고받을대상이멀리떨어져있기때문에소프트웨어차원에서호스트들간에연결을해주는장치가필요 이러한기능을해주는장치로소켓이라는인터페이스를많이사용 소켓프로그래밍이란용어와네트워크프로그래밍이랑용어가같은의미로사용

More information

untitled

untitled while do-while for break continue while( ) ; #include 0 i int main(void) int meter; int i = 0; while(i < 3) meter = i * 1609; printf("%d %d \n", i, meter); i++; return 0; i i< 3 () 0 (1)

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 KeyPad Device Control - Device driver Jo, Heeseung HBE-SM5-S4210 에는 16 개의 Tack Switch 를사용하여 4 행 4 열의 Keypad 가장착 4x4 Keypad 2 KeyPad 를제어하기위하여 FPGA 내부에 KeyPad controller 가구현 KeyPad controller 16bit 로구성된

More information

중간고사

중간고사 중간고사 예제 1 사용자로부터받은두개의숫자 x, y 중에서큰수를찾는알고리즘을의사코드로작성하시오. Step 1: Input x, y Step 2: if (x > y) then MAX

More information

vi 사용법

vi 사용법 네트워크프로그래밍 6 장과제샘플코드 - 1:1 채팅 (udp 버전 ) 과제 서버에서먼저 bind 하고그포트를다른사람에게알려줄것 클라이언트에서알려준포트로접속 서로간에키보드입력을받아상대방에게메시지전송 2 Makefile 1 SRC_DIR =../../common 2 COM_OBJS = $(SRC_DIR)/addressUtility.o $(SRC_DIR)/dieWithMessage.o

More information

; struct point p[10] = {{1, 2, {5, -3, {-3, 5, {-6, -2, {2, 2, {-3, -3, {-9, 2, {7, 8, {-6, 4, {8, -5; for (i = 0; i < 10; i++){ if (p[i].x > 0 && p[i

; struct point p[10] = {{1, 2, {5, -3, {-3, 5, {-6, -2, {2, 2, {-3, -3, {-9, 2, {7, 8, {-6, 4, {8, -5; for (i = 0; i < 10; i++){ if (p[i].x > 0 && p[i ; struct point p; printf("0이아닌점의좌표를입력하시오 : "); scanf("%d %d", &p.x, &p.y); if (p.x > 0 && p.y > 0) printf("1사분면에있다.\n"); if (p.x < 0 && p.y > 0) printf("2사분면에있다.\n"); if (p.x < 0 && p.y < 0) printf("3사분면에있다.\n");

More information

chap7.key

chap7.key 1 7 C 2 7.1 C (System Calls) Unix UNIX man Section 2 C. C (Library Functions) C 1975 Dennis Ritchie ANSI C Standard Library 3 (system call). 4 C?... 5 C (text file), C. (binary file). 6 C 1. : fopen( )

More information

Microsoft PowerPoint - lab14.pptx

Microsoft PowerPoint - lab14.pptx Mobile & Embedded System Lab. Dept. of Computer Engineering Kyung Hee Univ. Keypad Device Control in Embedded Linux HBE-SM5-S4210 에는 16 개의 Tack Switch 를사용하여 4 행 4 열의 Keypad 가장착되어있다. 2 Keypad Device Driver

More information

03장.스택.key

03장.스택.key ---------------- DATA STRUCTURES USING C ---------------- 03CHAPTER 1 ? (stack): (LIFO:Last-In First-Out) 2 : top : ( index -1 ),,, 3 : ( ) ( ) -> ->. ->.... 4 Stack ADT : (LIFO) : init():. is_empty():

More information

untitled

untitled Step Motor Device Driver Embedded System Lab. II Step Motor Step Motor Step Motor source Embedded System Lab. II 2 open loop, : : Pulse, 1 Pulse,, -, 1 +5%, step Step Motor (2),, Embedded System Lab. II

More information

C++-¿Ïº®Çؼ³10Àå

C++-¿Ïº®Çؼ³10Àå C C++. (preprocessor directives), C C++ C/C++... C++, C. C++ C. C C++. C,, C++, C++., C++.,.. #define #elif #else #error #if #itdef #ifndef #include #line #pragma #undef #.,.,. #include #include

More information

Microsoft PowerPoint - 08-C-App-19-Quick-Preprocessor

Microsoft PowerPoint - 08-C-App-19-Quick-Preprocessor 19. 전처리와분할컴파일 순천향대학교컴퓨터학부이상정 1 학습내용 전처리명령어 #include #define 기호상수 const 분할컴파일 순천향대학교컴퓨터학부이상정 2 전처리과정 전처리 (preprocessor) 전처리명령어는 # 기호로시작 #incldue #define 순천향대학교컴퓨터학부이상정 3 #include (1) 지정된파일을프로그램에삽입 꺽쇠괄호는포함할파일을컴파일러에설정되어있는특정디렉토리에서검색

More information

歯9장.PDF

歯9장.PDF 9 Hello!! C printf() scanf() getchar() putchar() gets() puts() fopen() fclose() fprintf() fscant() fgetc() fputs() fgets() gputs() fread() fwrite() fseek() ftell() I/O 2 (stream) C (text stream) : `/n'

More information

C 언어 프로그래밊 과제 풀이

C 언어 프로그래밊 과제 풀이 과제풀이 (1) 홀수 / 짝수판정 (1) /* 20094123 홍길동 20100324 */ /* even_or_odd.c */ /* 정수를입력받아홀수인지짝수인지판정하는프로그램 */ int number; printf(" 정수를입력하시오 => "); scanf("%d", &number); 확인 주석문 가필요한이유 printf 와 scanf 쌍

More information

untitled

untitled int i = 10; char c = 69; float f = 12.3; int i = 10; char c = 69; float f = 12.3; printf("i : %u\n", &i); // i printf("c : %u\n", &c); // c printf("f : %u\n", &f); // f return 0; i : 1245024 c : 1245015

More information

untitled

untitled 자료형 기본자료형 : char, int, float, double 등 파생자료형 : 배열, 열거형, 구조체, 공용체 vs struct 구조체 _ 태그 _ 이름 자료형멤버 _ 이름 ; 자료형멤버 _ 이름 ;... ; struct student int number; // char name[10]; // double height; // ; // x값과 y값으로이루어지는화면의좌표

More information

<4D F736F F F696E74202D20C1A63132B0AD20B5BFC0FB20B8DEB8F0B8AEC7D2B4E7>

<4D F736F F F696E74202D20C1A63132B0AD20B5BFC0FB20B8DEB8F0B8AEC7D2B4E7> 제14장 동적 메모리 할당 Dynamic Allocation void * malloc(sizeof(char)*256) void * calloc(sizeof(char), 256) void * realloc(void *, size_t); Self-Referece NODE struct selfref { int n; struct selfref *next; }; Linked

More information

untitled

untitled - -, (insert) (delete) - - (insert) (delete) (top ) - - (insert) (rear) (delete) (front) A A B top A B C top push(a) push(b) push(c) A B top pop() top A B D push(d) top #define MAX_STACK_SIZE 100 int

More information

Microsoft PowerPoint - chap12-고급기능.pptx

Microsoft PowerPoint - chap12-고급기능.pptx #include int main(void) int num; printf( Please enter an integer: "); scanf("%d", &num); if ( num < 0 ) printf("is negative.\n"); printf("num = %d\n", num); return 0; 1 학습목표 가 제공하는 매크로 상수와 매크로

More information

Microsoft PowerPoint - chap13-입출력라이브러리.pptx

Microsoft PowerPoint - chap13-입출력라이브러리.pptx #include int main(void) int num; printf( Please enter an integer: "); scanf("%d", &num); if ( num < 0 ) printf("is negative.\n"); printf("num = %d\n", num); return 0; 1 학습목표 스트림의 기본 개념을 알아보고,

More information

5.스택(강의자료).key

5.스택(강의자료).key CHP 5: https://www.youtube.com/watch?v=ns-r91557ds ? (stack): (LIFO:Last-In First-Out):. D C B C B C B C B (element) C (top) B (bottom) (DT) : n element : create() ::=. is_empty(s) ::=. is_full(s) ::=.

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 Web server porting 2 Jo, Heeseung Web 을이용한 LED 제어 Web 을이용한 LED 제어프로그램 web 에서데이터를전송받아타겟보드의 LED 를조작하는프로그램을작성하기위해다음과같은소스파일을생성 2 Web 을이용한 LED 제어 LED 제어프로그램작성 8bitled.html 파일을작성 root@ubuntu:/working/web# vi

More information

02장.배열과 클래스

02장.배열과 클래스 ---------------- DATA STRUCTURES USING C ---------------- CHAPTER 배열과구조체 1/20 많은자료의처리? 배열 (array), 구조체 (struct) 성적처리프로그램에서 45 명의성적을저장하는방법 주소록프로그램에서친구들의다양한정보 ( 이름, 전화번호, 주소, 이메일등 ) 를통합하여저장하는방법 홍길동 이름 :

More information

商用

商用 商用 %{ /* * line numbering 1 */ int lineno = 1 % \n { lineno++ ECHO ^.*$ printf("%d\t%s", lineno, yytext) $ lex ln1.l $ gcc -o ln1 lex.yy.c -ll day := (1461*y) div 4 + (153*m+2) div 5 + d if a then c :=

More information

Microsoft PowerPoint - chap11-포인터의활용.pptx

Microsoft PowerPoint - chap11-포인터의활용.pptx #include int main(void) int num; printf( Please enter an integer: "); scanf("%d", &num); if ( num < 0 ) printf("is negative.\n"); printf("num = %d\n", num); return 0; 1 학습목표 포인터를 사용하는 다양한 방법에

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 Sensor Device Jo, Heeseung Sensor 실습 HBE-SM5-S4210 에는근접 / 가속도 / 컴파스센서가장착 각센서들을사용하기위한디바이스드라이버와어플리케이션을작성 2 근접 (Proximity) 센서 HBE-SM5-S4210 Camera Module 근접센서디바이스 근접센서는사물이다른사물에접촉되기이전에가까이접근하였는지를검출할목적으로사용 일반적으로생활에서자동문이나엘리베이터,

More information

교육지원 IT시스템 선진화

교육지원 IT시스템 선진화 Module 16: ioctl 을활용한 LED 제어디바이스드라이버 ESP30076 임베디드시스템프로그래밍 (Embedded System Programming) 조윤석 전산전자공학부 주차별목표 ioctl() 을활용법배우기 커널타이머와 ioctl 을활용하여 LED 제어용디바이스드라이브작성하기 2 IOCTL 을이용한드라이버제어 ioctl() 함수활용 어떤경우에는읽는용도로만쓰고,

More information

Microsoft PowerPoint - 08_(C_Programming)_(Korean)_Preprocessing

Microsoft PowerPoint - 08_(C_Programming)_(Korean)_Preprocessing C Programming 전처리 (Preprocessing) Seo, Doo-Ok Clickseo.com clickseo@gmail.com 목 차 C 전처리기 조건및분할컴파일 2 C 전처리기 C 전처리기 매크로상수 매크로함수 조건및분할컴파일 3 전처리 (Preprocessing) C 전처리기 (1/3) 원시소스파일을컴파일하기전에행해야할일련의작업 외부파일포함기능

More information

À©µµ³×Æ®¿÷ÇÁ·Î±×·¡¹Ö4Àå_ÃÖÁ¾

À©µµ³×Æ®¿÷ÇÁ·Î±×·¡¹Ö4Àå_ÃÖÁ¾ P a 02 r t Chapter 4 TCP Chapter 5 Chapter 6 UDP Chapter 7 Chapter 8 GUI C h a p t e r 04 TCP 1 3 1 2 3 TCP TCP TCP [ 4 2] listen connect send accept recv send recv [ 4 1] PC Internet Explorer HTTP HTTP

More information

<4D F736F F F696E74202D20C1A63137C0E520B5BFC0FBB8DEB8F0B8AEBFCD20BFACB0E1B8AEBDBAC6AE>

<4D F736F F F696E74202D20C1A63137C0E520B5BFC0FBB8DEB8F0B8AEBFCD20BFACB0E1B8AEBDBAC6AE> 쉽게풀어쓴 C 언어 Express 제 17 장동적메모리와연결리스트 이번장에서학습할내용 동적메모리할당의이해 동적메모리할당관련함수 연결리스트 동적메모리할당에대한개념을이해하고응용으로연결리스트를학습합니다. 동적할당메모리의개념 프로그램이메모리를할당받는방법 정적 (static) 동적 (dynamic) 정적메모리할당 정적메모리할당 프로그램이시작되기전에미리정해진크기의메모리를할당받는것

More information

chap8.PDF

chap8.PDF 8 Hello!! C 2 3 4 struct - {...... }; struct jum{ int x_axis; int y_axis; }; struct - {...... } - ; struct jum{ int x_axis; int y_axis; }point1, *point2; 5 struct {....... } - ; struct{ int x_axis; int

More information

기초컴퓨터프로그래밍

기초컴퓨터프로그래밍 구조체 #include int main() { } printf("structure\n"); printf("instructor: Keon Myung Lee\n"); return 0; 내용 구조체 (struct) Typedef 공용체 (union) 열거형 (enum) 구조체 구조체 (structure) 어떤대상을표현하는서로연관된항목 ( 변수 )

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 7-Segment Device Control - Device driver Jo, Heeseung HBE-SM5-S4210 의 M3 Module 에는 6 자리를가지는 7-Segment 모듈이아래그림처럼실장 6 Digit 7-Segment 2 6-Digit 7-Segment LED controller 16비트로구성된 2개의레지스터에의해제어 SEG_Sel_Reg(Segment

More information

61 62 63 64 234 235 p r i n t f ( % 5 d :, i+1); g e t s ( s t u d e n t _ n a m e [ i ] ) ; if (student_name[i][0] == \ 0 ) i = MAX; p r i n t f (\ n :\ n ); 6 1 for (i = 0; student_name[i][0]!= \ 0&&

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 7-Segment Device Control - Device driver Jo, Heeseung HBE-SM5-S4210 의 M3 Module 에는 6 자리를가지는 7-Segment 모듈이아래그림처럼실장 6 Digit 7-Segment 2 6-Digit 7-Segment LED Controller 16비트로구성된 2개의레지스터에의해제어 SEG_Sel_Reg(Segment

More information

/chroot/lib/ /chroot/etc/

/chroot/lib/ /chroot/etc/ 구축 환경 VirtualBox - Fedora 15 (kernel : 2.6.40.4-5.fc15.i686.PAE) 작동 원리 chroot유저 ssh 접속 -> 접속유저의 홈디렉토리 밑.ssh의 rc 파일 실행 -> daemonstart실행 -> daemon 작동 -> 접속 유저만의 Jail 디렉토리 생성 -> 접속 유저의.bashrc 의 chroot 명령어

More information

제1장 Unix란 무엇인가?

제1장  Unix란 무엇인가? 1 12 장파이프 2 12.1 파이프 파이프원리 $ who sort 파이프 3 물을보내는수도파이프와비슷 한프로세스는쓰기용파일디스크립터를이용하여파이프에데이터를보내고 ( 쓰고 ) 다른프로세스는읽기용파일디스크립터를이용하여그파이프에서데이터를받는다 ( 읽는다 ). 한방향 (one way) 통신 파이프생성 파이프는두개의파일디스크립터를갖는다. 하나는쓰기용이고다른하나는읽기용이다.

More information

untitled

untitled 1 hamks@dongguk.ac.kr (goal) (abstraction), (modularity), (interface) (efficient) (robust) C Unix C Unix (operating system) (network) (compiler) (machine architecture) 1 2 3 4 5 6 7 8 9 10 ANSI C Systems

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 7-SEGMENT DEVICE CONTROL - DEVICE DRIVER Jo, Heeseung 디바이스드라이버구현 : 7-SEGMENT HBE-SM5-S4210 의 M3 Module 에는 6 자리를가지는 7-Segment 모듈이아래그림처럼실장 6 Digit 7-Segment 2 디바이스드라이버구현 : 7-SEGMENT 6-Digit 7-Segment LED

More information

11장 포인터

11장 포인터 Dynamic Memory and Linked List 1 동적할당메모리의개념 프로그램이메모리를할당받는방법 정적 (static) 동적 (dynamic) 정적메모리할당 프로그램이시작되기전에미리정해진크기의메모리를할당받는것 메모리의크기는프로그램이시작하기전에결정 int i, j; int buffer[80]; char name[] = data structure"; 처음에결정된크기보다더큰입력이들어온다면처리하지못함

More information

13주-14주proc.PDF

13주-14주proc.PDF 12 : Pro*C/C++ 1 2 Embeded SQL 3 PRO *C 31 C/C++ PRO *C NOT! NOT AND && AND OR OR EQUAL == = SQL,,, Embeded SQL SQL 32 Pro*C C SQL Pro*C C, C Pro*C, C C 321, C char : char[n] : n int, short, long : float

More information

1장. 유닉스 시스템 프로그래밍 개요

1장.  유닉스 시스템 프로그래밍 개요 Unix 프로그래밍및실습 7 장. 시그널 - 과제보충 응용과제 1 부모프로세스는반복해서메뉴를출력하고사용자로부터주문을받아자식프로세스에게주문내용을알린다. (SIGUSR1) ( 일단주문을받으면음식이완료되기전까지 SIGUSR1 을제외한다른시그널은모두무시 ) timer 자식프로세스는주문을받으면조리를시작한다. ( 일단조리를시작하면음식이완성되기전까지 SIGALARM 을제외한다른시그널은모두무시

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 Text-LCD Device Control - Device driver Jo, Heeseung M3 모듈에장착되어있는 Tedxt LCD 장치를제어하는 App 을개발 TextLCD 는영문자와숫자일본어, 특수문자를표현하는데사용되는디바이스 HBE-SM5-S4210 의 TextLCD 는 16 문자 *2 라인을 Display 할수있으며, 이 TextLCD 를제어하기위하여

More information

C 프로그래밊 개요

C 프로그래밊 개요 구조체 2009 년 5 월 19 일 김경중 강의계획수정 일자계획 Quiz 실습보강 5 월 19 일 ( 화 ) 구조체 Quiz ( 함수 ) 5 월 21 일 ( 목 ) 구조체저녁 6 시 5 월 26 일 ( 화 ) 포인터 5 월 28 일 ( 목 ) 특강 (12:00-1:30) 6 월 2 일 ( 화 ) 포인터 Quiz ( 구조체 ) 저녁 6 시 6 월 4 일 ( 목

More information

Sena Technologies, Inc. HelloDevice Super 1.1.0

Sena Technologies, Inc. HelloDevice Super 1.1.0 HelloDevice Super 110 Copyright 1998-2005, All rights reserved HelloDevice 210 ()137-130 Tel: (02) 573-5422 Fax: (02) 573-7710 E-Mail: support@senacom Website: http://wwwsenacom Revision history Revision

More information

<322EBCF8C8AF28BFACBDC0B9AEC1A6292E687770>

<322EBCF8C8AF28BFACBDC0B9AEC1A6292E687770> 연습문제해답 5 4 3 2 1 0 함수의반환값 =15 5 4 3 2 1 0 함수의반환값 =95 10 7 4 1-2 함수의반환값 =3 1 2 3 4 5 연습문제해답 1. C 언어에서의배열에대하여다음중맞는것은? (1) 3차원이상의배열은불가능하다. (2) 배열의이름은포인터와같은역할을한다. (3) 배열의인덱스는 1에서부터시작한다. (4) 선언한다음, 실행도중에배열의크기를변경하는것이가능하다.

More information

0. 표지에이름과학번을적으시오. (6) 1. 변수 x, y 가 integer type 이라가정하고다음빈칸에 x 와 y 의계산결과값을적으시오. (5) x = (3 + 7) * 6; x = 60 x = (12 + 6) / 2 * 3; x = 27 x = 3 * (8 / 4

0. 표지에이름과학번을적으시오. (6) 1. 변수 x, y 가 integer type 이라가정하고다음빈칸에 x 와 y 의계산결과값을적으시오. (5) x = (3 + 7) * 6; x = 60 x = (12 + 6) / 2 * 3; x = 27 x = 3 * (8 / 4 Introduction to software design 2012-1 Final 2012.06.13 16:00-18:00 Student ID: Name: - 1 - 0. 표지에이름과학번을적으시오. (6) 1. 변수 x, y 가 integer type 이라가정하고다음빈칸에 x 와 y 의계산결과값을적으시오. (5) x = (3 + 7) * 6; x = 60 x

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 C 언어포인터정복하기 16 강. 포인터로자료구조화하기 TAE-HYONG KIM COMPUTER ENG, KIT 2 학습내용 구조체멤버와구조체포인터멤버 다른구조체 ( 변수 ) 를가리키는구조체 ( 변수 ) 연결된리스트 의구성및관리 포인터로 연결된리스트 탐색하기 3 중첩구조체에자료저장하기 중첩된구조체변수에값저장하기 struct person { char PRID[15];

More information

이번장에서학습할내용 동적메모리란? malloc() 와 calloc() 연결리스트 파일을이용하면보다많은데이터를유용하고지속적으로사용및관리할수있습니다. 2

이번장에서학습할내용 동적메모리란? malloc() 와 calloc() 연결리스트 파일을이용하면보다많은데이터를유용하고지속적으로사용및관리할수있습니다. 2 제 17 장동적메모리와연결리스트 유준범 (JUNBEOM YOO) Ver. 2.0 jbyoo@konkuk.ac.kr http://dslab.konkuk.ac.kr 본강의자료는생능출판사의 PPT 강의자료 를기반으로제작되었습니다. 이번장에서학습할내용 동적메모리란? malloc() 와 calloc() 연결리스트 파일을이용하면보다많은데이터를유용하고지속적으로사용및관리할수있습니다.

More information

<4D F736F F F696E74202D20B8AEB4AABDBA20BFC0B7F920C3B3B8AEC7CFB1E22E BC8A3C8AF20B8F0B5E55D>

<4D F736F F F696E74202D20B8AEB4AABDBA20BFC0B7F920C3B3B8AEC7CFB1E22E BC8A3C8AF20B8F0B5E55D> 리눅스 오류처리하기 2007. 11. 28 안효창 라이브러리함수의오류번호얻기 errno 변수기능오류번호를저장한다. 기본형 extern int errno; 헤더파일 라이브러리함수호출에실패했을때함수예 정수값을반환하는함수 -1 반환 open 함수 포인터를반환하는함수 NULL 반환 fopen 함수 2 유닉스 / 리눅스 라이브러리함수의오류번호얻기 19-1

More information

int main(void) int a; int b; a=3; b=a+5; printf("a : %d \n", a); printf("b : %d \n", b); a b 3 a a+5 b &a(12ff60) &b(12ff54) 3 a 8 b printf(" a : %x \

int main(void) int a; int b; a=3; b=a+5; printf(a : %d \n, a); printf(b : %d \n, b); a b 3 a a+5 b &a(12ff60) &b(12ff54) 3 a 8 b printf( a : %x \ ? 1 int main(void) int a; int b; a=3; b=a+5; printf("a : %d \n", a); printf("b : %d \n", b); a b 3 a a+5 b &a(12ff60) &b(12ff54) 3 a 8 b printf(" a : %x \n", &a); printf(" b : %x \n", &b); * : 12ff60,

More information

14 주차구조체와공용체

14 주차구조체와공용체 14 주차구조체와공용체 구조체의개념, 정의, 초기화방법 구조체와포인터와의관계 공용체와 typedef 자료형구조 자료형 (data type) 기초자료형 파생자료형 사용자정의자료형 char int float double void 배열포인터구조체공용체 typedef enum 구조체의용도 복잡한형태의데이터란한가지형태의자료가아닌복합형의자료로구성되어있어기본자료형이나배열로는표현하기힘든형태의데이터를말한다.

More information

컴파일러

컴파일러 YACC 응용예 Desktop Calculator 7/23 Lex 입력 수식문법을위한 lex 입력 : calc.l %{ #include calc.tab.h" %} %% [0-9]+ return(number) [ \t] \n return(0) \+ return('+') \* return('*'). { printf("'%c': illegal character\n",

More information

C 프로그래밊 개요

C 프로그래밊 개요 함수 (2) 2009 년 9 월 24 일 김경중 공지사항 10 월 1 일목요일수업휴강 숙제 #1 마감 : 10 월 6 일화요일 기초 함수를만들어라! 입력 함수 ( 기능수행 ) 반환 사용자정의함수 정의 : 사용자가자신의목적에따라직접작성한함수 함수의원형 (Function Prototype) + 함수의본체 (Function Body) : 함수의원형은함수에대한기본적정보만을포함

More information

Microsoft PowerPoint - ch09 - 연결형리스트, Stack, Queue와 응용 pm0100

Microsoft PowerPoint - ch09 - 연결형리스트, Stack, Queue와 응용 pm0100 2015-1 프로그래밍언어 9. 연결형리스트, Stack, Queue 2015 년 5 월 4 일 교수김영탁 영남대학교공과대학정보통신공학과 (Tel : +82-53-810-2497; Fax : +82-53-810-4742 http://antl.yu.ac.kr/; E-mail : ytkim@yu.ac.kr) 연결리스트 (Linked List) 연결리스트연산 Stack

More information

제 14 장포인터활용 유준범 (JUNBEOM YOO) Ver 본강의자료는생능출판사의 PPT 강의자료 를기반으로제작되었습니다.

제 14 장포인터활용 유준범 (JUNBEOM YOO) Ver 본강의자료는생능출판사의 PPT 강의자료 를기반으로제작되었습니다. 제 14 장포인터활용 유준범 (JUNBEOM YOO) Ver. 2.0 jbyoo@konkuk.ac.kr http://dslab.konkuk.ac.kr 본강의자료는생능출판사의 PPT 강의자료 를기반으로제작되었습니다. 이번장에서학습할내용 이중포인터란무엇인가? 포인터배열 함수포인터 다차원배열과포인터 void 포인터 포인터는다양한용도로유용하게활용될수있습니다. 2 이중포인터

More information

윤성우의 열혈 TCP/IP 소켓 프로그래밍

윤성우의 열혈 TCP/IP 소켓 프로그래밍 C 프로그래밍프로젝트 Chap 22. 구조체와사용자정의자료형 1 2013.10.10. 오병우 컴퓨터공학과 구조체의정의 (Structure) 구조체 하나이상의기본자료형을기반으로사용자정의자료형 (User Defined Data Type) 을만들수있는문법요소 배열 vs. 구조체 배열 : 한가지자료형의집합 구조체 : 여러가지자료형의집합 사용자정의자료형 struct

More information

프로그래밍개론및실습 2015 년 2 학기프로그래밍개론및실습과목으로본내용은강의교재인생능출판사, 두근두근 C 언어수업, 천인국지음을발췌수정하였음

프로그래밍개론및실습 2015 년 2 학기프로그래밍개론및실습과목으로본내용은강의교재인생능출판사, 두근두근 C 언어수업, 천인국지음을발췌수정하였음 프로그래밍개론및실습 2015 년 2 학기프로그래밍개론및실습과목으로본내용은강의교재인생능출판사, 두근두근 C 언어수업, 천인국지음을발췌수정하였음 CHAPTER 9 둘중하나선택하기 관계연산자 두개의피연산자를비교하는연산자 결과값은참 (1) 아니면거짓 (0) x == y x 와 y 의값이같은지비교한다. 관계연산자 연산자 의미 x == y x와 y가같은가? x!= y

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 Development Environment 2 Jo, Heeseung make make Definition make is utility to maintain groups of programs Object If some file is modified, make detects it and update files related with modified one It

More information

Microsoft PowerPoint - Chapter_08.pptx

Microsoft PowerPoint - Chapter_08.pptx 프로그래밍 1 1 Chapter 8. Pointers May, 2016 Dept. of software Dankook University http://embedded.dankook.ac.kr/~baeksj 포인터의개념 (1/6) 2 포인터란 : 다른객체를가리키는변수 객체의메모리주소를저장하는변수 기호적방식 (symbolic way) 으로주소사용 포인터와관련된연산자

More information

Microsoft PowerPoint - Chapter_09.pptx

Microsoft PowerPoint - Chapter_09.pptx 프로그래밍 1 1 Chapter 9. Structures May, 2016 Dept. of software Dankook University http://embedded.dankook.ac.kr/~baeksj 구조체의개념 (1/4) 2 (0,0) 구조체 : 다양한종류의데이터로구성된사용자정의데이터타입 복잡한자료를다루는것을편하게해줌 예 #1: 정수로이루어진 x,

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 DEVELOPMENT ENVIRONMENT 2 MAKE Jo, Heeseung MAKE Definition make is utility to maintain groups of programs Object If some file is modified, make detects it and update files related with modified one 2

More information

Microsoft PowerPoint - ch10 - 이진트리, AVL 트리, 트리 응용 pm0600

Microsoft PowerPoint - ch10 - 이진트리, AVL 트리, 트리 응용 pm0600 균형이진탐색트리 -VL Tree delson, Velskii, Landis에의해 1962년에제안됨 VL trees are balanced n VL Tree is a binary search tree such that for every internal node v of T, the heights of the children of v can differ by at

More information

3. 1 포인터란 3. 2 포인터변수의선언과사용 3. 3 다차원포인터변수의선언과사용 3. 4 주소의가감산 3. 5 함수포인터

3. 1 포인터란 3. 2 포인터변수의선언과사용 3. 3 다차원포인터변수의선언과사용 3. 4 주소의가감산 3. 5 함수포인터 - Part2-3 3. 1 포인터란 3. 2 포인터변수의선언과사용 3. 3 다차원포인터변수의선언과사용 3. 4 주소의가감산 3. 5 함수포인터 3.1 포인터란 ü ü ü. ü. ü. ü ( ) ? 3.1 ü. ü C ( ).? ü ü PART2-4 ü ( ) PART3-4 3.2 포인터변수의선언과사용 3.2 포인터 변수의 선언과 사용 (1/8) 포인터 변수의

More information

Microsoft PowerPoint - Lesson13.pptx

Microsoft PowerPoint - Lesson13.pptx 2008 Spring Computer Engineering g Programming g 1 Lesson 13 - 제 16 장파일입출력 Lecturer: JUNBEOM YOO jbyoo@konkuk.ac.kr 본강의자료는생능출판사의 PPT 강의자료 를기반으로제작되었습니다. 이번장에서학습할내용 파일의기초 텍스트파일읽기와쓰기 이진파일읽기와쓰기 임의접근파일 파일을이용하면보다많은데이터를유용하고지속적으로사용및관리할수있습니다.

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 Web server porting 2 Jo, Heeseung Web 을이용한 LED 제어 Web 을이용한 LED 제어프로그램 web 에서데이터를전송받아타겟보드의 LED 를조작하는프로그램을작성하기위해다음과같은소스파일을생성 2 Web 을이용한 LED 제어 LED 제어프로그램작성 8bitled.html 파일을작성 root@ubuntu:/working/web# vi

More information

Line (A) å j a k= i k #define max(a, b) (((a) >= (b))? (a) : (b)) long MaxSubseqSum0(int A[], unsigned Left, unsigned Right) { int Center, i; long Max

Line (A) å j a k= i k #define max(a, b) (((a) >= (b))? (a) : (b)) long MaxSubseqSum0(int A[], unsigned Left, unsigned Right) { int Center, i; long Max 알고리즘설계와분석 (CSE3081-2반 ) 중간고사 (2013년 10월24일 ( 목 ) 오전 10시30분 ) 담당교수 : 서강대학교컴퓨터공학과임인성수강학년 : 2학년문제 : 총 8쪽 12문제 ========================================= < 주의 > 답안지에답을쓴후제출할것. 만약공간이부족하면답안지의뒷면을이용하고반드시답을쓰는칸에답안지의어느쪽의뒷면에답을기술하였는지명시할것.

More information

Microsoft PowerPoint - chap05-제어문.pptx

Microsoft PowerPoint - chap05-제어문.pptx int num; printf( Please enter an integer: "); scanf("%d", &num); if ( num < 0 ) printf("is negative.\n"); printf("num = %d\n", num); 1 학습목표 제어문인,, 분기문에 대해 알아본다. 인 if와 switch의 사용 방법과 사용시 주의사항에 대해 알아본다.

More information

Chapter 4. LISTS

Chapter 4. LISTS 6. 동치관계 (Equivalence Relations) 동치관계 reflexive, symmetric, transitive 성질을만족 "equal to"(=) 관계는동치관계임. x = x x = y 이면 y = x x = y 이고 y = z 이면 x = z 동치관계를이용하여집합 S 를 동치클래스 로분할 동일한클래스내의원소 x, y 에대해서는 x y 관계성립

More information

Microsoft PowerPoint - ch08 - 구조체 (structure) am0845

Microsoft PowerPoint - ch08 - 구조체 (structure) am0845 2015-1 프로그래밍언어 8. 구조체 (Structure) 2015 년 4 월 11 일 교수김영탁 영남대학교공과대학정보통신공학과 (Tel : +82-53-810-2497; Fax : +82-53-810-4742 http://antl.yu.ac.kr/; E-mail : ytkim@yu.ac.kr) Outline 구조체란무엇인가? 구조체의선언, 초기화, 사용

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 Chapter 15 고급프로그램을 만들기위한 C... 1. main( ) 함수의숨겨진이야기 2. 헤더파일 3. 전처리문과예약어 1. main( ) 함수의숨겨진이야기 main( ) 함수의매개변수 [ 기본 14-1] main( ) 함수에매개변수를사용한예 1 01 #include 02 03 int main(int argc, char* argv[])

More information

<4D F736F F F696E74202D20C1A63134C0E520C6F7C0CEC5CD5FC8B0BFEB>

<4D F736F F F696E74202D20C1A63134C0E520C6F7C0CEC5CD5FC8B0BFEB> 쉽게풀어쓴 C 언어 Express 제 14 장포인터활용 이중포인터 이중포인터 (double pointer) : 포인터를가리키는포인터 int i = 10; int *p = &i; int **q = &p; // i 는 int 형변수 // p 는 i 를가리키는포인터 // q 는포인터 p 를가리키는이중포인터 이중포인터 이중포인터의해석 이중포인터 // 이중포인터프로그램

More information

6주차.key

6주차.key 6, Process concept A program in execution Program code PCB (process control block) Program counter, registers, etc. Stack Heap Data section => global variable Process in memory Process state New Running

More information

구조체정의 자료형 (data types) 기본자료형 (primitive data types) : char, int, float 등과같이 C 언어에서제공하는자료형. 사용자정의자료형 (user-defined data types) : 다양한자료형을묶어서목적에따라새로운자료형을

구조체정의 자료형 (data types) 기본자료형 (primitive data types) : char, int, float 등과같이 C 언어에서제공하는자료형. 사용자정의자료형 (user-defined data types) : 다양한자료형을묶어서목적에따라새로운자료형을 (structures) 구조체정의 구조체선언및초기화 구조체배열 구조체포인터 구조체배열과포인터 구조체와함수 중첩된구조체 구조체동적할당 공용체 (union) 1 구조체정의 자료형 (data types) 기본자료형 (primitive data types) : char, int, float 등과같이 C 언어에서제공하는자료형. 사용자정의자료형 (user-defined

More information

강의10

강의10 Computer Programming gdb and awk 12 th Lecture 김현철컴퓨터공학부서울대학교 순서 C Compiler and Linker 보충 Static vs Shared Libraries ( 계속 ) gdb awk Q&A Shared vs Static Libraries ( 계속 ) Advantage of Using Libraries Reduced

More information

금오공대 컴퓨터공학전공 강의자료

금오공대 컴퓨터공학전공 강의자료 C 프로그래밍프로젝트 Chap 27. 파일의분할과헤더파일의디자인 2013.09.11. 오병우 컴퓨터공학과 설계 (design) 중요 27-1 프로그램의모듈화 변경, 확장등의유지보수가용이하도록설계 C 언어에서는 module 구성중요 C++, Java 등의객체지향언어에서는 class, abstraction 중요 Design Patterns 에대해 2 학년여름방학이나겨울방학에공부해보시기바랍니다.

More information

1 장 C 언어복습 표준입출력배열포인터배열과포인터함수 const와포인터구조체컴파일러사용방법 C++ 프로그래밍입문

1 장 C 언어복습 표준입출력배열포인터배열과포인터함수 const와포인터구조체컴파일러사용방법 C++ 프로그래밍입문 1 장 C 언어복습 표준입출력배열포인터배열과포인터함수 const와포인터구조체컴파일러사용방법 C++ 프로그래밍입문 1. 표준입출력 표준입출력 입력 : 키보드, scanf 함수 출력 : 모니터, printf 함수문제 : 정수값 2개를입력받고두값사이의값들을더하여출력하라. #include int main(void) int Num1, Num2; int

More information

프로그램을 학교 등지에서 조금이라도 배운 사람들을 위한 프로그래밍 노트 입니다. 저 역시 그 사람들 중 하나 입니다. 중고등학교 시절 학교 도서관, 새로 생긴 시립 도서관 등을 다니며 책을 보 고 정리하며 어느정도 독학으르 공부하긴 했지만, 자주 안하다 보면 금방 잊어

프로그램을 학교 등지에서 조금이라도 배운 사람들을 위한 프로그래밍 노트 입니다. 저 역시 그 사람들 중 하나 입니다. 중고등학교 시절 학교 도서관, 새로 생긴 시립 도서관 등을 다니며 책을 보 고 정리하며 어느정도 독학으르 공부하긴 했지만, 자주 안하다 보면 금방 잊어 개나리 연구소 C 언어 노트 (tyback.egloos.com) 프로그램을 학교 등지에서 조금이라도 배운 사람들을 위한 프로그래밍 노트 입니다. 저 역시 그 사람들 중 하나 입니다. 중고등학교 시절 학교 도서관, 새로 생긴 시립 도서관 등을 다니며 책을 보 고 정리하며 어느정도 독학으르 공부하긴 했지만, 자주 안하다 보면 금방 잊어먹고 하더라구요. 그래서,

More information

PowerPoint 프레젠테이션

PowerPoint 프레젠테이션 System Software Experiment 1 Lecture 5 - Array Spring 2019 Hwansoo Han (hhan@skku.edu) Advanced Research on Compilers and Systems, ARCS LAB Sungkyunkwan University http://arcs.skku.edu/ 1 배열 (Array) 동일한타입의데이터가여러개저장되어있는저장장소

More information

이번장에서학습할내용 구조체란무엇인가? 구조체의선언, 초기화, 사용 구조체의배열 구조체와포인터 구조체와함수 공용체 열거형 typedef 구조체는복잡한내용을일목요연하여정리하는데유용하게사용됩니다. 2

이번장에서학습할내용 구조체란무엇인가? 구조체의선언, 초기화, 사용 구조체의배열 구조체와포인터 구조체와함수 공용체 열거형 typedef 구조체는복잡한내용을일목요연하여정리하는데유용하게사용됩니다. 2 제 13 장구조체 유준범 (JUNBEOM YOO) Ver. 2.0 jbyoo@konkuk.ac.kr http://dslab.konkuk.ac.kr 본강의자료는생능출판사의 PPT 강의자료 를기반으로제작되었습니다. 이번장에서학습할내용 구조체란무엇인가? 구조체의선언, 초기화, 사용 구조체의배열 구조체와포인터 구조체와함수 공용체 열거형 typedef 구조체는복잡한내용을일목요연하여정리하는데유용하게사용됩니다.

More information

untitled

untitled 시스템소프트웨어 : 운영체제, 컴파일러, 어셈블러, 링커, 로더, 프로그래밍도구등 소프트웨어 응용소프트웨어 : 워드프로세서, 스프레드쉬트, 그래픽프로그램, 미디어재생기등 1 n ( x + x +... + ) 1 2 x n 00001111 10111111 01000101 11111000 00001111 10111111 01001101 11111000

More information

http://cafedaumnet/pway Chapter 1 Chapter 2 21 printf("this is my first program\n"); printf("\n"); printf("-------------------------\n"); printf("this is my second program\n"); printf("-------------------------\n");

More information

Microsoft PowerPoint - chap10-함수의활용.pptx

Microsoft PowerPoint - chap10-함수의활용.pptx #include int main(void) { int num; printf( Please enter an integer: "); scanf("%d", &num); if ( num < 0 ) printf("is negative.\n"); printf("num = %d\n", num); return 0; } 1 학습목표 중 값에 의한 전달 방법과

More information

ch15

ch15 쉽게풀어쓴 C 언어 Express 제 14 장포인터활용 C Express 이중포인터 이중포인터 (double pointer) : 포인터를가리키는포인터 int i = 10; int *p = &i; int **q = &p; // i 는 int 형변수 // p 는 i 를가리키는포인터 // q 는포인터 p 를가리키는이중포인터 이중포인터 이중포인터의해석 이중포인터 //

More information

Microsoft PowerPoint - ch07 - 포인터 pm0415

Microsoft PowerPoint - ch07 - 포인터 pm0415 함수의인수 (argument) 전달방법 C 에서함수의인수전달방법 값에의한호출 (call-by-value): 기본적인방법 포인터에의한호출 (call-by-pointer): 포인터이용 참조에의한호출 (call-by-reference): 참조 (reference) 이용 7-35 값에의한호출 (call-by-value) 함수호출시에변수의값을함수에복사본으로전달 복사본이전달되며,

More information

Microsoft PowerPoint - chap-07.pptx

Microsoft PowerPoint - chap-07.pptx 쉽게풀어쓴 C 언어 Express 제 7 장반복문 컴퓨터프로그래밍기초 이번장에서학습할내용 반복의개념이해 while 반복문 do-while 반복문 for 반복문 break와 continue 문 반복구조는일련의처리를반복할수있게한다. 반복의개념을먼저이해하고 C에서제공되는 3가지의반복구조에대하여학습한다. 컴퓨터프로그래밍기초 2 반복문 Q) 반복구조는왜필요한가? A)

More information

11장 포인터

11장 포인터 쉽게풀어쓴 C 언어 Express 제 12 장문자와문자열 이번장에서학습할내용 문자표현방법 문자열표현방법 문자열이란무엇인가? 문자열의입출력 문자처리라이브러리함수 표준입출력라이브러리함수 인간은문자를사용하여정보를표현하므로문자열은프로그램에서중요한위치를차지하고있다. 이번장에서는 C 에서의문자열처리방법에대하여자세히살펴볼것이다. 문자의중요성 인간한테텍스트는대단히중요하다.

More information

금오공대 컴퓨터공학전공 강의자료

금오공대 컴퓨터공학전공 강의자료 C 프로그래밍프로젝트 Chap 13. 포인터와배열! 함께이해하기 2013.10.02. 오병우 컴퓨터공학과 13-1 포인터와배열의관계 Programming in C, 정재은저, 사이텍미디어. 9 장참조 ( 교재의 13-1 은읽지말것 ) 배열이름의정체 배열이름은 Compile 시의 Symbol 로서첫번째요소의주소값을나타낸다. Symbol 로서컴파일시에만유효함 실행시에는메모리에잡히지않음

More information

02 C h a p t e r Java

02 C h a p t e r Java 02 C h a p t e r Java Bioinformatics in J a va,, 2 1,,,, C++, Python, (Java),,, (http://wwwbiojavaorg),, 13, 3D GUI,,, (Java programming language) (Sun Microsystems) 1995 1990 (green project) TV 22 CHAPTER

More information

슬라이드 1

슬라이드 1 5. 표준입력 : scanf scanf 의기본사용법 키보드로값을입력받아지정한변수에저장함 scanf( %d, &i ); 키보드로정수를입력받아, i 변수에저장함 scanf( %d %d, &i, &j ); 키보드로정수두개를입력받아, 각각 i, j 변수에저장함 scanf( %d %f, &i, &f ); 키보드로정수와실수를각각입력받아, 정수형변수 i, 실수형변수 f

More information

Microsoft PowerPoint - chap09-1.ppt

Microsoft PowerPoint - chap09-1.ppt 참고자료 : chapter 9-1. 구조체 박종혁 Tel: 970-6702 Email: jhpark1@snut.ac.kr 한빛미디어 출처 : 뇌를자극하는 C프로그래밍, 한빛미디어 -1- 구조체의형선언과멤버참조 구조체는배열과달리다른형태의자료형도묶어서처리할수있다. 한학생과관련된여러형태의데이터를묶어서처리할수있으므로배열보다효율적이다. - 5 명의학생에대한학번과학점을처리하는예

More information

Microsoft PowerPoint - Chapter14_17.pptx

Microsoft PowerPoint - Chapter14_17.pptx Computer Engineering g Programming g 2 - 제 17 장동적메모리와연결리스트 - 제 14 장포인터활용 Lecturer: JUNBEOM YOO jbyoo@konkuk.ac.kr 본강의자료는생능출판사의 PPT 강의자료 를기반으로제작되었습니다. 이번장에서학습할내용 동적할당메모리 연결리스트 이중포인터 포인터배열 다차원배열과포인터 main

More information

Microsoft PowerPoint - Lesson14.pptx

Microsoft PowerPoint - Lesson14.pptx 2008 Spring Computer Engineering g Programming g 1 Lesson 14 - 제 17 장동적메모리와연결리스트 - 제14 장포인터활용 Lecturer: JUNBEOM YOO jbyoo@konkuk.ac.kr 본강의자료는생능출판사의 PPT 강의자료 를기반으로제작되었습니다. 이번장에서학습할내용 동적할당메모리 연결리스트 이중포인터

More information

Microsoft PowerPoint - Lesson14.pptx

Microsoft PowerPoint - Lesson14.pptx 2009 Spring Computer Engineering g Programming g 1 Lesson 14 - 제 17 장동적메모리와연결리스트 - 제14 장포인터활용 Lecturer: JUNBEOM YOO jbyoo@konkuk.ac.kr 본강의자료는생능출판사의 PPT 강의자료 를기반으로제작되었습니다. 이번장에서학습할내용 동적할당메모리 연결리스트 이중포인터

More information

< E20C6DFBFFEBEEE20C0DBBCBAC0BB20C0A7C7D12043BEF0BEEE20492E707074>

< E20C6DFBFFEBEEE20C0DBBCBAC0BB20C0A7C7D12043BEF0BEEE20492E707074> Chap #2 펌웨어작성을위한 C 언어 I http://www.smartdisplay.co.kr 강의계획 Chap1. 강의계획및디지털논리이론 Chap2. 펌웨어작성을위한 C 언어 I Chap3. 펌웨어작성을위한 C 언어 II Chap4. AT89S52 메모리구조 Chap5. SD-52 보드구성과코드메모리프로그래밍방법 Chap6. 어드레스디코딩 ( 매핑 ) 과어셈블리어코딩방법

More information

(Asynchronous Mode) ( 1, 5~8, 1~2) & (Parity) 1 ; * S erial Port (BIOS INT 14H) - 1 -

(Asynchronous Mode) ( 1, 5~8, 1~2) & (Parity) 1 ; * S erial Port (BIOS INT 14H) - 1 - (Asynchronous Mode) - - - ( 1, 5~8, 1~2) & (Parity) 1 ; * S erial Port (BIOS INT 14H) - 1 - UART (Univ ers al As y nchronous Receiver / T rans mitter) 8250A 8250A { COM1(3F8H). - Line Control Register

More information