fork(1) download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. int tam;
  5. printf("Digite o tamanho: ");
  6. scanf("%d", &tam);
  7. int vet[tam];
  8. for (int i = 1; i <= tam; i++) vet[i] = i;
  9. for (int i = 1; i <= tam; i++) printf("%d ", vet[i]);
  10. }
  11.  
  12. //https://pt.stackoverflow.com/q/34060/101
Success #stdin #stdout 0s 5396KB
stdin
3
stdout
Digite o tamanho: 1 2 3