전체 글70 CS증폭기 40배 증폭기 설계 MOSFET Parameter V_OUT = 1 -> 1.0399 V_IN = 700m -> 699m 따라서 v_out = 0.04 v_in = 1m 이므로 40배 증폭이 됐다. 2023. 1. 19. [C/C++] 구조체2 구조체 포인터 동적메모리 이용 #include #include #include #include struct member { char name[20]; int age; }; void show_members(struct member *p, int size) { for(int i=0; iname, (p+i)->age); } } int main() { system("chcp 65001"); //gcc 한글깨짐 방지 printf("\n"); struct member *p; // 동적할당 p = (member *)malloc(sizeof(member) *4); // 구조체의 크기 : char 20개, int 1개 이므로 총 24바이트 // 4가 곱해져있으므로 맴버 4명 생성 if(p == NULL) { printf.. 2023. 1. 8. [C/C++] 구조체1 구조체 객체지향 언어에서 클래스와 유사 서로 다른 자료형을 한번에 다루기 위해 사용 ※ 배열의 경우는 같은 자료형 #include #include //system #include //strcpy struct student { int age; char major[20]; }; int main() { system("chcp 65001"); //gcc 한글깨짐 방지 printf("\n"); student a; a.age = 21; strcpy(a.major, "전자공학"); student b; b.age = 22; strcpy(b.major, "기계공학"); printf("a는 %d살 이고 전공은 %s 이다.\n", a.age, a.major); printf("b는 %d살 이고 전공은 %s 이다.\n", b... 2023. 1. 8. [C/C++] 포인터 문자열 포인터로 문자열 출력 문자열의 경우 마지막에 '\0' NULL 존재 #include #include int main() { system("chcp 65001"); //gcc 한글깨짐 방지 printf("\n"); char mystring[100]; char *p = &mystring[0]; printf("입력 : "); scanf("%s", &mystring); printf("출력 : "); while(1) { if(*p != '\0') { printf("%c", *p); p = p + sizeof(char); } else { break; } } printf("\n"); return 0; } 2023. 1. 7. 이전 1 2 3 4 ··· 18 다음