본문 바로가기

c13

Python - C/C++ API Reference Manual Interface Stable Application Binary Interface 전통적으로 Python의 C API는 모든 릴리스마다 변경 될 것입니다. 대부분의 변경 사항은 기존 API를 변경하거나 API를 제거하지 않고 (일부 인터페이스는 먼저 사용 중지 된 후에 제거됨) 일반적으로 API 만 추가하여 소스와 호환됩니다. 아쉽게도 API 호환성은 ABI (이진 호환성)로 확장되지 않습니다. 그 이유는 기본적으로 구조체 정의가 진화 한 것이므로 새로운 필드를 추가하거나 필드의 유형을 변경하면 API가 손상되지는 않지만 ABI가 손상 될 수 있습니다. 결과적으로 확장 모듈은 파이썬 릴리스마다 다시 컴파일해야합니다 (영향을받는 인터페이스가 사용되지 않는 경우 유닉스에서 예외가 가능함). 또한 Windows에서 확장 모듈은.. 2019. 4. 19.
Python - C/C++ API Reference Manual Introduction Embedding & Extended Python / C&CPP Introduction Python 인터페이스를 통해 C 및 C ++ 프로그래머는 Python 인터프리터에 액세스 할 수 있다. API는 C ++에서도 똑같이 사용할 수 있다. 특정 목적을 위해 확장 모듈을 작성. 이들은 파이썬 인터프리터를 확장하는 C 모듈입니다. 아마도 가장 일반적인 용도 일 것입니다. 큰 응용 프로그램에서 파이썬을 구성 요소로 사용 이 기술은 일반적으로 응용 프로그램에 파이썬 임베딩이라고합니다. 일반적으로 확장하는 것이 임베딩하는 것보다 슆다. Python에서 제공하는 API함수는 확장하거나 임베딩하는 것과 관계 없이 유용하지만 임베딩하는 것보다 확장기능에 먼저 익숙해지기를 추천한다. Coding standards 특히.. 2019. 4. 19.
C - Input output 표준 입출력 #include #include #include #define doSomethingElse(input) do{ printf("your input is %d\n", input); }while(0) int main(void) {int input, iInput[10];int status, iNum;char cInput1[50], cInput2[50];// Identify wether it is a letter or a number/*while ((status = scanf("%d", &input)) != EOF) {if (status == 0) {printf("Not a number\n");while (getchar() != '\n'); //clear input}else {doSomethingElse(inpu.. 2019. 3. 8.
C - malloc_ c 메모리 동적할당 C - malloc_ c 메모리 동적할당 // Memory allocation #include #include #include int main(void){int iInput, iMax;int *iStudent = NULL; fputs("Please enter the max number of array :", stdout);scanf_s("%d", &iMax); iStudent = (int *)malloc(iMax * sizeof(int)); for (int i = 0; i < iMax; ++i){printf_s("%2d 번 학생의 점수 입력 : ",i+1);scanf_s("%d", &iInput);iStudent[i] = iInput;}for (int i = 0; i < iMax; ++i){ printf.. 2019. 3. 8.
8. C_lesson 단항 연산자 !not,~비트not,+,- 단항 연산자 !not,~비트not,+,- #include #include 5); int d = ~2; // ~[비트not 연산자] int e = -b; //-1 x b[- 연산자] int f = ~d+!!!d; printf("a = %d\n",a); printf("b = %d\n",b); printf("c = %d\n",c); printf("d = %d ~d = %d\n",d,~d); printf("e = %d -e = %d\n",e,-e); printf("f = %d \n",f); getch(); } 일반논리 NOT연산자는 참 이면 거짓으로 거짓이면 참으로참 = 1 발생거짓 = 0 발생 비트 NOT 연산자는 이진수연산을 하면서 보수화 시키는데음수로 보수화 될경우 하나큰 음수 결과값이 되고 ex) ~2 .. 2013. 10. 9.
7. C_lesson 별로만든 뒤집어진 트리 program #include int main(void){int iInput, iSpace, iStar, iLimit, mMinus; printf("층 수를 입력하세요:");scanf("%d", &iInput); iMinus = iInputi; for(iLimit=0; iLimit < iInput; ++iLimit){for(iSpace=0; iSpace < iLimit; ++iSpace){printf(" ");} for(iStar=1; iStar < iMinus * 2; ++iStar){printf("*");}printf("\n");iMinus--;} return 0;} #include int main(void) { int i; int j; int k; int l; int m; int n; printf("층 수를 입력.. 2013. 9. 29.