Created
February 17, 2016 21:59
-
-
Save werbet/845666064b252822310f to your computer and use it in GitHub Desktop.
Alocação de memória
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
int main() | |
{ | |
int quantidade; | |
int* p; | |
int i; | |
int j; | |
printf("Digite a quantidade de meias: \n"); | |
scanf("%d", &quantidade); | |
printf("quantidade = %d \n", quantidade); | |
p = malloc(quantidade * sizeof(int)); | |
for(i = 0; i < quantidade; i++) | |
p[i] = i; | |
for(j = 0; j < quantidade; j++) | |
printf("p[%d] = %d \n", j, p[j]); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment