For example;
#include<stdio.h>
int a[1000000]={0},b[1000000];//Prevent stack overflow
int main(){
int n,m,i,j,k=0;
scanf("% d",&n);
for(i=n-1;i>=0;i--){
Scanf("%d",&a[i]);
}
scanf("%d",&m);
for(j=0;j<m;j++){
scanf("%d",&b[j]);
}
. . . . .
+5Votes
C language default does not prevent stack overflow function
This is implemented by the compiler
Some compilers have stack check and can also set stack size
And your program, a is a global variable, it is generally allocated in the static area, independent of the stack
+4Votes
C language array and The stack has a hair relationship
+4Votes
inc returns the address of the first element of the array a, that is, the pointer b is assigned the address of the first element of the array a, also points to the array a, and No new memory is allocated, and a and b point to the same array. If you need to allocate new memory, you can use malloc. b = (u8 *) malloc(8 * sizeof(u8)); // dynamically allocate 8 spaces of size u8