#include #include #include #include int function1(int argument) { int * p = (int *)malloc(sizeof(int)); int k[10]; printf("%s\n", __FUNCTION__); free(p); return argument; } struct Document { int i; struct Document * head; struct Document * tail; //int foo(int argument) { printf("%s\n", __FUNCTION__); return argument; } }; int function2(int argument) { int * p = (int *)malloc(sizeof(int)); int k[10]; printf("%s\n", __FUNCTION__); return argument; } struct Document * bar() { struct Document * document = (struct Document *)malloc(sizeof(struct Document)); // cycle document->head = (struct Document *)malloc(sizeof(struct Document)); document->head->head = (struct Document *)malloc(sizeof(struct Document)); document->head->head->head = document; return document; } const char * const text1 = "Is this on?"; int const array1[] = {1, 2, 3, 4, 5}; int main() { typedef int (*function3_t)(int argument); function3_t function3 = function2; int temporary = 1; struct Document * document = (struct Document *)calloc(10, sizeof(struct Document)); document = (struct Document *)realloc(document, sizeof(struct Document) * 20); printf("%i\n", 1); struct Document * result = bar();//->foo(temporary); printf("%i\n", 2); printf("%d\n", ++ document[18].i); printf("%p\n", document[18].head); printf("%p\n", document[18].tail); function1(1); function2(1); const char * const text2 = "Is this on?"; static int const array2[] = {1, 2, 3, 4, 5}; char * text3 = strdup(text2); printf("%s\n", text2); printf("The magic number is: %i\n", 3.1416); memcpy(text3, text2, strlen(text2)); printf("text3 = %s\n", text3); memset(text3, 0, strlen(text2)); printf("text3 = %s\n", text3); text3 = strndup(text2, 50); printf("text3 = %s\n", text3); text3 = NULL; char buffer[256]; const char * cwd = getcwd(buffer, sizeof(buffer)); printf("cwd = %s\n", cwd); const char * const text4 = strdup(cwd); printf("text4 = %s\n", text4); }