![]() |
| ||
| A Challenging Debugging Problem Hello, The code below calculates the determinant of the matrix. I know that the method of global 2-d pointers is a poor programming practice (so u don't need to reply saying that!!!), but it is a simple method for an amateur programmer. As the code didn't work, I set two watches, (After giving the input as a 3x3 matrix with elements numbered from 1 to 9) one on e[k][l] & another on b[k1][l1]. To my surprise, b[k1][l1] got modified on its own inspite the fact that e[k][l] at k=1 and l=1 had the value of 5. Somebody plz help me out. -Jishnu. #include<iostream.h> |
| ||
| Re: A Challenging Debugging Problem >>float **a; that is the declaration of a 2-dimensional array of floats. Somewhat similar to this when both dimensions are known: float a[2][5]Before allocating memory for the second dimension (5 in the above dimension) you have to allocate memory for the first (2 in the above example) Line 18 is using an uninitialized variable a. You have to allocate the matrix like this: a = new float*[o]; // allocate first dimension |
| ||
| Re: A Challenging Debugging Problem I suppose we'll have to wait a while longer for you to discover indentation as well as code tags :icon_rolleyes: Also, whether you intend this to be a C program or a C++ program (and not some random mix like it is at the moment). |
| All times are GMT -4. The time now is 3:57 am. |
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC