Alocação de memória

Run Settings
LanguageC
Language Version
Run Command
#include <stdio.h> #include <conio.h> #include <stdlib.h> main(){ int *p = malloc(2*sizeof(int)); int i = 0, k; while(1){ printf("Digite um numero:\n"); scanf("%d", &k); p = realloc(p,(i+1)*sizeof(int)); p[i] = k; i++; if(k == 0) break; } printf("\n================================\n\n"); int y = 0; for(y = i-1; y >= 0; y--){ printf("%d\n", p[y]); } free(p); getch();
Editor Settings
Theme
Key bindings
Full width
Lines