Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8974471
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T18:41:22+00:00 2026-06-15T18:41:22+00:00

This code below is the code for finding the determinant for 3×3 matrix (this

  • 0

This code below is the code for finding the determinant for 3×3 matrix (this code is intended for nxn matrix, but for the sample, I used 3×3), using recursive
The result is working fine, but I wonder what errors in this code make this must be the printf(“\n”) before calling the sub-function (itself) or else it will return the error 0xc0000fd (stack overflow).

#include "stdio.h"
#include "stdlib.h"
#include "conio.h"
#define size 3


void trimarray(int**rrayrc,int**rrayout, int dim,int cuti,int cutj)
{
    int i, j;
    int ti = 0,tj;

    for(i = 0; i<dim; i++)
    {
        tj = 0;
        for(j = 0; j< dim; j++)
        {
            if(!((i==cuti)||(j==cutj)))
            {
                    rrayout[ti][tj] = rrayrc[i][j];
            }
            if(j!=cutj) {tj++;}
        }
        if(i!=cuti) {ti++;}
    }

}
void initializearray(int** rray,int dim)
{
    int i, j;
    for(i = 0; i<dim; i++)
    {
        for(j = 0; j<dim; j++)
        {
            rray[i][j] = 0;
        }
    }
}
int det(int** rray, int dim)
{
    int i,j;
    int cut[dim-1][dim-1];
    int* cutp[i];
    int mul = 1,sum=0;
    if(dim >1)
    {
        for(i = 0; i<dim-1; i++)
        {
            cutp[i] = cut[i];
        }
        initializearray(cutp,dim-1);
        for(i = 0; i<dim; i++)
        {
            printf("\n",dim); //<< Without this the program won't work
            trimarray(rray,cutp,dim,0,i);
            sum+=det(cutp,dim-1)*mul*rray[0][i];
            mul = 0-mul;
        }
        return sum;

    }
    else
    {
        return rray[0][0];
    }
}
int main()
{
    int test[size][size] = {2,-3,-2,-6,3,3,-2,-3,-2};
    int* testpntr[size];
    int i,deter;
    for(i = 0; i<size; i++)
    {
        testpntr[i] = test[i];
    }
    deter = det(testpntr,size);
    printf("[%d]",deter);
    getch();

    return 0;
}

The answers will be dearly appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T18:41:23+00:00Added an answer on June 15, 2026 at 6:41 pm

    int* cutp[i]; is undefined behavior since i is uninitialized at this stage. You have no idea what is the size of cutp array.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am having trouble finding an answer to this. Consider the clipping code below:
i am using this code below to dynamically capture the name of the button
This code below allows me to find the word error in all my files
This code below is for executing ls -l | wc -l. In the code,
This code below works in all web browsers except IE: <input type="text" name="passwordLogin" value="Password"
This code below doesn't work correctly since my MFC program is in unicode circumstance.
The code below is creating a server to communicate with clients.This code works fine
how to put this code below? - (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component { NSString *year
I have this code below. I need to use a class id instead of
I have this code below. As you can see I am passing two variables

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.