Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Autor : Tiago Portela
- Email : sapitando@gmail.com
- Sobre : Compilado com GCC e LCC.
- Obs : Apenas tentando aprender algoritimos, sozinho, por hobby. */
- #include <stdio.h>
- #include <stdlib.h>
- #include <stdint.h>
- #include <string.h>
- #include <conio.h>
- int main(void){
- void *lpGP;
- lpGP = calloc(3,sizeof(void*));
- ((void**)(lpGP))[0] = malloc(11 * sizeof(char));
- strcpy(((char**)(lpGP))[0], "ABCDEFGHIJ");
- strcpy(&((char**)(lpGP))[0][0], "ABCDEFGHIJ");
- strcpy(&((char*)(((void**)(lpGP))[0]))[0], "ABCDEFGHIJ");
- strcpy((char*)(((void**)(lpGP))[0]), "ABCDEFGHIJ");
- ((void**)(lpGP))[1] = malloc(2 * sizeof(int));
- ((int**)(lpGP))[1][0] = 250;
- *(*(((int**)(lpGP)) + 1) + 0) = 250;
- ((int*)(((void**)(lpGP))[1]))[0] = 250;
- *((int*)(*(((void**)(lpGP)) + 1)) + 0) = 250;
- *((int*)((char*)(*(((void**)(lpGP)) + 1)) + (0 * sizeof(int)))) = 250;
- ((int**)(lpGP))[1][1] = 500;
- *(*(((int**)(lpGP)) + 1) + 1) = 500;
- ((int*)(((void**)(lpGP))[1]))[1] = 500;
- *((int*)(*(((void**)(lpGP)) + 1)) + 1) = 500;
- *((int*)((char*)(*(((void**)(lpGP)) + 1)) + (1 * sizeof(int)))) = 500;
- ((void**)(lpGP))[2] = malloc(2 * sizeof(float));
- ((float**)(lpGP))[2][0] = 5.25;
- *(*(((float**)(lpGP)) + 2) + 0) = 5.25;
- ((float*)(((void**)(lpGP))[2]))[0] = 5.25;
- *((float*)(*(((void**)(lpGP)) + 2)) + 0) = 5.25;
- *((float*)((char*)(*(((void**)(lpGP)) + 2)) + (0 * sizeof(float)))) = 5.25;
- ((float**)(lpGP))[2][1] = 10.50;
- *(*(((float**)(lpGP)) + 2) + 1) = 10.50;
- ((float*)(((void**)(lpGP))[2]))[1] = 10.50;
- *((float*)(*(((void**)(lpGP)) + 2)) + 1) = 10.50;
- *((float*)((char*)(*(((void**)(lpGP)) + 2)) + (1 * sizeof(float)))) = 10.50;
- printf("%p -> %p\n", (void*)(&lpGP), (void*)(lpGP));
- puts("");
- printf("%p -> %p\n", (void*)(&((void**)(lpGP))[0]), ((void**)(lpGP))[0]);
- printf("%p -> %p\n", (void*)(((void**)(lpGP)) + 0), *(((void**)(lpGP)) + 0));
- puts("");
- printf("%p -> %p\n", (void*)(&((void**)(lpGP))[1]), ((void**)(lpGP))[1]);
- printf("%p -> %p\n", (void*)(((void**)(lpGP)) + 1), *(((void**)(lpGP)) + 1));
- puts("");
- printf("%p -> %p\n", (void*)(&((void**)(lpGP))[2]), ((void**)(lpGP))[2]);
- printf("%p -> %p\n", (void*)(((void**)(lpGP)) + 2), *(((void**)(lpGP)) + 2));
- puts("");
- printf("%p = %s\n", (void*)(&((char*)(((void**)(lpGP))[0]))[0]), &((char*)(((void**)(lpGP))[0]))[0]);
- printf("%p = %s\n", (void*)((char*)(*(((void**)(lpGP)) + 0)) + 0), ((char*)(*(((void**)(lpGP)) + 0)) + 0));
- puts("");
- printf("%p = %i\n", (void*)(&((int*)(((void**)(lpGP))[1]))[0]), ((int*)(((void**)(lpGP))[1]))[0]);
- printf("%p = %i\n", (void*)((int*)(*(((void**)(lpGP)) + 1)) + 0), *((int*)(*(((void**)(lpGP)) + 1)) + 0));
- printf("%p = %i\n", (void*)((char*)(*(((void**)(lpGP)) + 1)) + (0 * sizeof(int))), *((int*)((char*)(*(((void**)(lpGP)) + 1)) + (0 * sizeof(int)))));
- printf("%p = %i\n", (void*)(&((int*)(((void**)(lpGP))[1]))[1]), ((int*)(((void**)(lpGP))[1]))[1]);
- printf("%p = %i\n", (void*)((int*)(*(((void**)(lpGP)) + 1)) + 1), *((int*)(*(((void**)(lpGP)) + 1)) + 1));
- printf("%p = %i\n", (void*)((char*)(*(((void**)(lpGP)) + 1)) + (1 * sizeof(int))), *((int*)((char*)(*(((void**)(lpGP)) + 1)) + (1 * sizeof(int)))));
- puts("");
- printf("%p = %f\n", (void*)(&((float*)(((void**)(lpGP))[2]))[0]), ((float*)(((void**)(lpGP))[2]))[0]);
- printf("%p = %f\n", (void*)((float*)(*(((void**)(lpGP)) + 2)) + 0), *((float*)(*(((void**)(lpGP)) + 2)) + 0));
- printf("%p = %f\n", (void*)((char*)(*(((void**)(lpGP)) + 2)) + (0 * sizeof(float))), *((float*)((char*)(*(((void**)(lpGP)) + 2)) + (0 * sizeof(float)))));
- printf("%p = %f\n", (void*)(&((float*)(((void**)(lpGP))[2]))[1]), ((float*)(((void**)(lpGP))[2]))[1]);
- printf("%p = %f\n", (void*)((float*)(*(((void**)(lpGP)) + 2)) + 1), *((float*)(*(((void**)(lpGP)) + 2)) + 1));
- printf("%p = %f\n", (void*)((char*)(*(((void**)(lpGP)) + 2)) + (1 * sizeof(float))), *((float*)((char*)(*(((void**)(lpGP)) + 2)) + (1 * sizeof(float)))));
- getch();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement