I'm trying to write a code that takes a couple of inputs, calls upon the function to calculate a value, assigns that value to a variable and print that variable. I actually need to form a matrix out of these values.
When I assign the value to a regular variable, the program does what is expected. So if the main function is like this:
//some user-defined functions that the main function calls//
void main()
{
    int m,n;
    printf("Row: ");
    scanf("%d",&m);
    printf("Column: ");
    scanf("%d",&n);
    double k,A;
    printf("k= ");
    scanf("%lf",&k);
    A=matrix_element(m,n,k);
    printf("%lf",A);
}
The output is correct:
Row: 1
Column: 1
k= 1
2.275499
Process returned 8 (0x8)   execution time : 5.974 s
Press any key to continue.
But when I try to assign the value to an element in an array, the program doesn't work. I mean to say, if the main function is like this:
//some user-defined functions that the main function calls//
void main()
{
    int m,n;
    printf("Row: ");
    scanf("%d",&m);
    printf("Column: ");
    scanf("%d",&n);
    double k,A[800][800];
    printf("k= ");
    scanf("%lf",&k);
    A[m][n]=matrix_element(m,n,k);
    printf("%lf",A[m][n]);
}
The program does nothing:
Process returned -1073741571 (0xC00000FD)   execution time : 2.207 s
Press any key to continue.
What is happening and how can I fix it? I have to take the values in an 800x800 2D array because my end goal is to put it in a for loop and form a matrix of these dimensions.
For those who want to see the MCVE code, here it is:
#include <stdio.h>
double S(int g, int i) //Scattering Cross-section//
{
    double x;
    x=2;
    return x;
}
double D(int g, int i) //Diffusion co-efficient//
{
    double x;
    x=2;
    return x;
}
double A(int g, int i) //Absorption Cross-section//
{
    double x;
    x=2;
    return x;
}
double vF(int g, int i) //velocity x Fission Cross-section//
{
    double x;
    x=2;
    return x;
}
double F(int g, int i) //Fission Cross-section//
{
    double x;
    x=2;
    return x;
}
double h(int i) //Height//
{
    double x;
    x=2;
    return x;
}
double matrix_element(int m, int n, double k)
{
    int g,i;
    double C;
    C=1;
    return C;
}
void main()
{
    int m,n;
    printf("Row: ");
    scanf("%d",&m);
    printf("Column: ");
    scanf("%d",&n);
    double k,A[800][800];
    printf("k= ");
    scanf("%lf",&k);
    A[m][n]=matrix_element(m,n,k);
    printf("%lf",A[m][n]);
}
This one produces the same problem.
 
     
     
     
    