Large array local variable leads to segmentation fault

I am trying to use memcpy to copy Mat’s data member data to a one dimensional array and the following code is ok when the data type is unsigned char, but why can’t it be a double type? The error is Segmentation fault, how do I pass the double type?
thanks in advance!

cv::Mat gray;
cv::cvtColor(RGBimage, gray, cv::COLOR_BGR2GRAY);
gray.convertTo(gray, CV_64FC1, 1.0 / 255.0, 0.0); // gray is 720*1280 size image

double src[777600]; // 720*1280=777600
memcpy(src, (double *), 777600U*sizeof(double)); // error: Segmentation fault

Maybe it’s because my arrays are too big?

you can bet on that. DO NOT put such huge arrays on the stack. learn about the difference between stack and heap, and where local variables live.