일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 | 31 |
- C
- Python
- greedy
- Algospot
- 백준
- 따배씨
- Math
- 종만북
- Cleancode
- programmers
- dfs
- DP
- 따라하며 배우는 C언어
- 정수론
- JavaScript
- BOJ
- Algorithm
- BASIC
- graph
- server
- 인프런
- C언어
- php
- udemy
- String
- 생활코딩
- web
- 따라하면서 배우는 C언어
- BFS
- sorting
- Today
- Total
목록Language (271)
몽상실현개발주의

따배씨 - 따라하며 배우는 C언어 14강 구조체_1 14.4 구조체의 메모리 할당 Memory Allocation #include #include int main() { /* Well aligned structure */ struct Aligned { int a; float b; double c; }; // structure 를 선언한는 것으로 메모리를 차지 하지 않음 /* 0 1 2 3 4 5 6 7|8 9 10 11 12 13 14 15| |int a |float b|double c 4 + 4 + 8 = 16 */ struct Aligned a1, a2; // 구조체 변수들이 만들어 질 때, 메모리가 할당 됨 printf("struct Aligned a1\n"); // struct Aligned a1..

따배씨 - 따라하며 배우는 C언어 14강 구조체_1 14.2 구조체 Strucutres 의 기본적인 사용법 #include #include #include #define MAX 41 struct person /* person is a tag of structure */ { char name[MAX]; int age; float height; }; int main() { int flag; // Receives retur value of scanf() /* Structre variable */ struct person genie; /* dot(.) is strucutre membership operator (member access operator, member operater) */ strcpy(genie..

따배씨 - 따라하며 배우는 C언어 14강 구조체_1 14.1 구조체 Structures 가 필요한 이유 많은 데이터를 처리 하기 위히여 사용 자료형이 다르지만 함께 사용하면 편리한 데이터 오브젝트끼리 모아둔 것 배열은 자료형이 같은 데이터 오브젝트들이 나열된 형태 서로 자료형이 다르더라도 묶어서 하나의 새로운 자료형인 것 처럼 사용 struct Patient p1, p2, p3;// structure variables 새로운 자료형으로 변수/배열 을 선언할 수 있음 Dot(.) 연산자는 구조체의 member 에 접근하는 연산자 이 글의 모든 사진과 내용의 출처는 홍정모 교수님께 있음을 알려드립니다. http://blog.naver.com/atelierjpro 실리콘 밸리의 프로그래머 : 네이버 블로그 안..

따배씨 - 따라하며 배우는 C언어 13강 파일 입출력 13.8 텍스트 파일을 바이너리 처럼 읽어보기 #include int main() { FILE* fp = fopen("test.txt", "rb"); unsigned char ch; while(fread(&ch, sizeof(unsigned char), 1, fp) > 0) { printf("%hhu %c \n", ch, ch); } fclose(fp); return 0; } // 출력 65 A 66 B 67 C 10 68 D 69 E 10 49 1 50 2 51 3 10 67 C 236 \354 150 \226 184 \270 236 \354 150 \226 180 \264 10 이 글의 모든 사진과 내용의 출처는 홍정모 교수님께 있음을 알려드립니다..

따배씨 - 따라하며 배우는 C언어 13강 파일 입출력 13.7 기타 입출력 함수들 ungetc() fflush() setvbuf() #include int main() { FILE* fp; int ch; /* ungetc() */ fp = fopen("input.txt", "r"); ch = fgetc(fp); fputc(ch, stdout); ungetc(ch, fp); // fputc(ch, stdout) 의 결과가 다시 출력됨 ungetc((int)'A', fp); // fputc(ch, stdout) 의 결과를 'A'로 변경하여 출력 ch = fgetc(fp); fputc(ch, stdout); fclose(fp); return 0; } ungetc(ch, fp); 스트림에 마지막으로 읽어들여졌던..

따배씨 - 따라하며 배우는 C언어 13강 파일 입출력 13.5 바이너리 파일 입출력 #include #include int main(void){ /* fopen() mode tring for binary IO - "rb, "wb", "ab" - "ab+", "a+b" - "wb+", "w+b" - "ab+" , "a+b" C11 'x' mode fails if the file exists, insteda of overwriting it. - "wx", "wbx", "wb+x", "w+bx" */ // FILE Writing { FILE* fp = fopen("binary_file", "wb"); double d = 1.0 / 3.0; int n = 123; int* parr = (int*)malloc(s..

따배씨 - 따라하며 배우는 C언어 13강 파일 입출력 13.4 텍스트 파일 모드 스트링과 다양한 입출력 함수들 fprintf() fscanf() fgets() fputs() #include #include #include #define MAX 31 int main(void){ FILE * fp; char words[MAX] = {'\0'}; const char* filename = "record.txt"; /* fopne() mode strings for text fiels - r : reading - w : creating-and-writing or over-writing - a : appending or creating-and-writing - r+ : both rading and writing - ..

따배씨 - 따라하며 배우는 C언어 13강 파일 입출력 13.3 텍스트 인코딩 Encoding 과 코드 페이지 Code Page 문자가 text File 에 저장되는 방식은 binary Text File 이 저장되는 Endcoding 방식과, console 이 text File 을 읽는 Decoding 방식이 다르면 비 정상적인 문자열로 출력됨 SetConsoleOutputCP(CP_UTF8); console 창에서 문자열을 출력하는 방식을 UTF8 로 지정 이 글의 모든 사진과 내용의 출처는 홍정모 교수님께 있음을 알려드립니다. http://blog.naver.com/atelierjpro 실리콘 밸리의 프로그래머 : 네이버 블로그 안녕하세요! 홍정모 블로그에 오신 것을 환영합니다. 주로 프로그래밍 관련 ..