You don't have a type name stack, stack is a variable not a type. Your function should look more like (if you're using a C compiler):
void check(int v[5001][5001],int i,int j,int k,struct yes *stack, int &size)
(if you're using a C++ compiler): void check(int v[5001][5001],int i,int j,int k,yes *stack, int &size)
You don't seem to realize that you're creating a global variable of type yes named stack that is an array with a size of 5001 when you defined that structure.