Created
May 2, 2020 19:53
-
-
Save lesimoes/50bce8a1362f9e910e18dd8b689c3df4 to your computer and use it in GitHub Desktop.
Revisions
-
lesimoes created this gist
May 2, 2020 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,20 @@ #include <stdio.h> int main(int argc, const char * argv[]) { int tamanho; printf("Digite um tamanho para o vetor: "); scanf("%d", &tamanho); //Aqui separamos um espaço em memório dinamicamente do tamanhao digitado pelo usuário int *vetor = (int *) malloc(tamanho * sizeof(int)); for (int i = 0 ; i < tamanho ; i ++) { vetor[i] = i + 1; printf("%d ", vetor[i]); } printf("\n"); return 0; } This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,13 @@ #include <stdio.h> int main(int argc, const char * argv[]) { printf("Espaço de int: %d\n", sizeof(int)); printf("Espaço de double: %d\n", sizeof(double)); printf("Espaço de float: %d\n", sizeof(float)); printf("Espaço de char: %d\n", sizeof(char)); printf("\n"); return 0; }