Guest User

Untitled

a guest
Oct 20th, 2017
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <malloc.h>
  3. #include <stdlib.h>
  4.  
  5. int main()
  6. {
  7. int *a; // указатель на массив
  8. int i, n;
  9.  
  10. printf("Введите размер массива: ");
  11. scanf("%d", &n);
  12.  
  13. // Выделение памяти
  14. a = (int*)malloc(n * sizeof(int));
  15.  
  16. // Ввод элементов массива
  17. for (i = 0; i<n; i++)
  18. {
  19. printf("a[%d] = ", i);
  20. scanf("%d", &a[i]);
  21. }
  22.  
  23. // Вывод элементов массива
  24. for (i = 0; i<n; i++)
  25. printf("%d ", a[i]);
  26.  
  27. free(a);
  28.  
  29. getchar();
  30. return 0;
  31. }
  32.  
  33. int length = 1;
  34. scanf("%d", &length);
  35. double array[length];
  36. ...
Add Comment
Please, Sign In to add comment