목록Study/C (16)
Rylah's Study & Daily Life

#include int main(void) { int num; printf("num? "); scanf("%d", &num); printf("you input number is %d\n", num); return 0; }

#include #include #include #include int main(void) { time_t* cur_time; // 포인터변수만 선언하고 메모리를 참조하지 않고 사용해서 오류 발생 time(cur_time); printf("Current Time = %d\n", (int) *cur_time); return 0; } 수정한 소스 #include #include #include #include int main(void) { time_t* cur_time =(time_t*)malloc(sizeof(time_t)); // 포인터변수만 선언하고 메모리를 참조하지 않고 사용해서 오류 발생 time(cur_time); printf("Current Time = %d\n", (int) *cur_time)..

man 2 time (타임 시스템 콜 메뉴얼) SYNOPIS : 이 형식으로 작성해야 함 DESCRIPTION : 기능 설명 Return Value : 반환 값 라이브러리에서 메뉴얼 부르기 man 3 memset SYNOPIS : 이 형식으로 작성해야 함 DESCRIPTION : 기능 설명 Return Value : 반환 값 리눅스에서 math와 같은 라이브러리를 컴파일 하기 위해서는 -lm 같은 명령어를 사용해야 한다.

Use Ubuntu 20.43 LTS(Long Term Support) https://ubuntu.com/download/desktop Download Ubuntu Desktop | Download | Ubuntu Ubuntu is an open source software operating system that runs from the desktop, to the cloud, to all your internet connected things. ubuntu.com use VMware Player https://www.vmware.com/kr/products/workstation-player.html 설치는 알아서 하실 수 있을겁니다. gcc 설치후 helloworld까지. gcc 설치 명령어는 sudo..

#include #include #define MAX 10000 int main(void) { // 파일 입출력 // 파일에 어떤 데이터를 저장 // 파일에 저장된 데이터를 불러오기 // fputs , fgets 쌍 -> 문자열 저장 // fprintf, fscanf 쌍 //char line[MAX]; // char line[10000] ////파일 열기 //FILE* file = fopen("c:\\test1.txt", "wb"); // r : read(읽기) , w : write(쓰기) , a : append(이어쓰기) // t(text) b(바이너리 데이터) //if (file == NULL) { //printf("파일 열기 실패\n"); //return 1; //} //fputs("fputs를 이..

#include struct GameInfo { char* name; int year; int price; char* company; struct GameInfo* friendGame; // 연관 게임 회사 }; typedef struct GameInformation { char* name; int year; int price; char* company; struct GameInfo* friendGame; // 연관 게임 회사 }GAME_INFO; int main(void) { // [게임 출시] // 이름 : 나도게임 // 발매년도 : 2017 년 // 가격 : 50원 // 제작사 : 나도회사 char* name = "나도게임"; int year = 2017; int price = 50; char* c..

#include int main(void) { // 다차원 배열 Miltdimensional Array //int i; // □ //int arr[5]; // □□□□□ // [0] [1] [2] [3] [4] //int arr2[2][5]; //□□□□□ //□□□□□ // // [0, 0] [0, 1] [0, 2] [0, 3] [0, 4] -> ex) arr2[0][0] // [1, 0] [1, 1] [1, 2] [1, 3] [1, 4] -> ex) arr2[1][4] //int arr3[4][2]; //□□ //□□ //□□ //□□ // [0, 0] [0, 1] -> ex) arr3[0][1] // [1, 0] [1, 1] // [2, 0] [2, 1] // [3, 0] [3, 1] -> ex) ..

#include int main(void) { //포인터 //[철수] : 101호 //[영희] : 201호 //[민수] : 301호 // 각 문앞에 '암호'가 걸려있음 int 철수 = 1; // 암호 int 영희 = 2; int 민수 = 3; printf("철수네 주소 : %d , 암호 : %d\n", &철수, 철수); printf("영희네 주소 : %d , 암호 : %d\n", &영희, 영희); printf("민수네 주소 : %d , 암호 : %d\n", &민수, 민수); // 미션맨! // 첫번째 미션 : 아파트의 각 집에 방문해서 문에 적힌 암호를 확인 int * 미션맨; // 포인터 변수 미션맨 = &철수; printf("미션맨의 방문하는 곳의 주소는 ? : %d, 암호는 ? : %d\n", 미션..