Click here to Skip to main content
15,887,027 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am getting the following exception in my code…
C++
const int row = 3;
const int col = test_open::width * test_open::height;
	
float **input_ary = new float*[row];
for(i=0;i<row;++i)>
{
	input_ary[i] = new float[col];			/*** Exception Here  ***/
}

The two int variables test_open::width and test_open::height are getting values properly but I am not able to create a 2D matrix.
Please help me.


[Edit]Code block added[/Edit]
Posted
Updated 10-Nov-12 9:51am
v3
Comments
Nelek 10-Nov-12 16:38pm    
Is the ">" in the line for(i=0;i<row;++i)> in your program? or is it a typo here?
By the way... where are you declaring "i"?
I have copied your code declaring "width", "height" and "i" and it runs without exceptions.

What is the message you are getting? what does the debugger say?
Richa Vats 11-Nov-12 4:57am    
I have declared 'i' as a global variable in my code and '>' is typing error here. it is not included in my code. I am getting the above exception while creating the 2D input matrix 'input_ary' and I am not getting the reason for the same
Nelek 11-Nov-12 5:41am    
As I said, I copied your code, made the necessary declarations (removing "test_open::") and executed it without exceptions. This is what I compiled (additions in bold):
const int width = 5, height = 6;
const int row = 3;
const int col = width * height;
float **input_ary = new float*[row];
for(int i=0;i<row;++i)>
{
input_ary[i] = new float[col];
}

So I think the problem is wether in the "i" or in the "test_open::" values
Richa Vats 1-Dec-12 11:29am    
thanku Nelek now my problem get solved... thanx for the help
Nelek 1-Dec-12 12:04pm    
You are welcome.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900