fork(1) download
  1. #include <stdio.h>
  2. #include<stdlib.h>
  3.  
  4. int main() {
  5. int M;
  6. printf("Entre com M: ");
  7. scanf("%d", &M);
  8. int *v = malloc(M * sizeof(int));
  9. for (int i = 0; i < M; ++i) {
  10. v[i] = i + 1;
  11. printf ("%d ", v[i]);
  12. }
  13. }
Success #stdin #stdout 0s 2304KB
stdin
6
stdout
Entre com M: 1 2 3 4 5 6