You use the uninitialized variable n when declaring an array of double mas[n] .
I understand - you want to dynamically create an array of the number of elements in which the user enters. To dynamically allocate memory, use the malloc function:
#include <stdio.h> #include <stdlib.h> #include <time.h> int main(void) { srand(time(NULL)); int n; double *parray = NULL; printf("\n Vvedite razmer massiva\n:"); scanf("%d", &n); // Allocate memory parray = (double *)malloc(n * sizeof(double)); if (!parray) { printf("Not enough memory. Sorry :(\n"); return 1; } // Fill array elements for (int i = 0, j = 0; i < n * sizeof(double); i += sizeof(double), j++) { *(parray + i) = (double)(rand()%10000)/100; printf("%f ", *(parray + i)); } free(parray); return 0; }