목록C, C++ /C (7)
배우고픈 공돌이
//main.c #include #include #include "list.h" void printInt(const void *pData) { printf("%d",*(int*)pData); } void printDouble(const void *pData) { printf("%f",*(double*)pData); } int main(void) { list_t list1, list2; initList(&list1, sizeof(int)); initList(&list2, sizeof(double)); int i=10;insertFirstNode(&list1,&i); int j = 40;insertNode(&list1,&i,&j); j = 30;insertNode(&list1,&i,&j); j = 20;in..
//main.c #include #include "queue.h" int main(void) { queue_t q1, q2; initQueue(&q1,10,sizeof(int)); initQueue(&q2,100,sizeof(double)); int i=100; push(&q1,&i); i=200; push(&q1,&i); i=300; push(&q1,&i); double j = 900.9; push(&q2,&j); j=800.8; push(&q2,&j); j=700.7; push(&q2,&j); pop(&q1,&i); printf("q1 1st pop : %d \n",i); pop(&q1,&i); printf("q1 2nd pop : %d \n",i); pop(&q1,&i); printf("q1 3rd..
//main.c #include #include "stack.h" int main(void) { stack_t s1, s2; initStack(&s1,10,sizeof(int)); initStack(&s2,100,sizeof(double)); int i=100; push(&s1,&i); i=200; push(&s1,&i); i=300; push(&s1,&i); double j = 900.9; push(&s2,&j); j=800.8; push(&s2,&j); j=700.7; push(&s2,&j); pop(&s1,&i); printf("s1 1st pop : %d \n",i); pop(&s1,&i); printf("s1 2nd pop : %d \n",i); pop(&s1,&i); printf("s1 3rd..
You have been given a string s, which is supposed to be a sentence. However, someone forgot to put spaces between the different words, and for some reason they capitalized the first letter of every word. Return the sentence after making the following amendments:Put a single space between the words.Convert the uppercase letters to lowercase.ExampleFor s = "CodefightsIsAwesome", the output should ..
참고로 다음은 등가적인 포인터의 예를 보입니다. (1) int a[4] ==> int *p (2) int *a[4] ==> int **p (3) int a[3][4] ==> int (*p)[4] (4) int a [2][3][4] ==> int (*p)[3][4] (5) int *(*a[3])(int) ==> int *(**p)(int) 원본 링크 : http://pelex529.blogspot.kr/2009/01/2.html
기능적 의미 : 노 캐시(no cache) 컴파일러가 프로그램이 시작될 때 속도를 위해 캐시로부터 값을 읽는다.주메모리에서 읽어야하는 임베디드의 상황상 volatile을 써서 하드웨어의 변경사항이 프로그램에 반영되도록 한다.또한 컴파일러가 최적화 조건으로 임의로 코드를 제거(데드 코드)하는 것을 막는다.
전처리문이란?실질적인 컴파일 이전에 미리 처리되는 문장을 가리킨다. 선행처리기라고도 한다. 따라서 컴파일러는 사용자가 작성한 코드를 컴파일하기 전에 전처리문에서 정의해 놓은 작업들을 먼저 수행한다.종류로는 #define, #if, #ifdef, #ifndef, #defined, #undef 등이 있다. 이것은 기존에 있는 방대한 소스 코드를 지우지 않고 활성화 비활성화 하는 데에 가장 많이 이용된다. 즉, 기존에 있는 소스 코드를 건드리지 않는 상태에서 부분적인 컴파일을 하는 것이다. C의 전처리문이 오는 줄(Line)의 첫 문자는 항상 ‘#’으로 시작한다. ANSI 표준에 따른 C의 전처리문의 종류가 아래에 나와 있다.파일 처리를 위한 전처리문 : #include형태 정의를 위한 전처리문 : #defi..