C Board  

Go Back   C Board > General Programming Boards > C++ Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 12-20-2007, 10:41 PM   #1
Registered User
 
Join Date: Dec 2007
Posts: 78
debug assertion failed!

can anyone tell me why i am getting error while runtime

Code:
Section defGeometry::formSection( Side Section1,Section Section2,int N1,int N2,int N4,int NumberOfPoints )
{defFile defG;
//std::vector Sections FinalSection;
int NoOfPoints,i,j,k;
N1=2;
N2=2;
j=0;
k=0;
NoOfPoints=2*N1;
struct Section defGeomSecTemp;
struct point x;

double defGeompt[3];

for(i=0;i<N4;i++)
{
	for(j=NumberOfPoints-N2;j>=NumberOfPoints-N2;j++)
	{
		x.pt[0]=Section1.Sections[N4].Points[NumberOfPoints-N2].pt[0];
		

	}
}		

return  Section3;
};

error


debug assertion failed!


vector subscript out of range
chintugavali is offline   Reply With Quote
Old 12-20-2007, 10:48 PM   #2
Senior software engineer
 
brewbuck's Avatar
 
Join Date: Mar 2007
Location: Portland, OR
Posts: 5,381
Quote:
Originally Posted by chintugavali View Post
can anyone tell me why i am getting error while runtime

vector subscript out of range
Perhaps it has to do with a vector subscript being out of range.
brewbuck is offline   Reply With Quote
Old 12-20-2007, 10:48 PM   #3
Kernel hacker
 
Join Date: Jul 2007
Location: Farncombe, Surrey, England
Posts: 15,686
You have a vector with X elements, and you are trying to "use" elements beyond X.

--
Mats
__________________
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
matsp is offline   Reply With Quote
Old 12-20-2007, 11:33 PM   #4
and the Hat of Guessing
 
tabstop's Avatar
 
Join Date: Nov 2007
Posts: 8,740
Again, you should check your subscripts. I don't know what the actual cause of your problem is, because that code doesn't make any sense. I'm hoping and wishing that what you've posted is not, in fact, your actual code, because otherwise you've got a lot of things missing. In future, post actual code.
tabstop is offline   Reply With Quote
Old 12-21-2007, 12:01 AM   #5
Registered User
 
Join Date: Dec 2007
Posts: 78
Smile thanks!!

Thanks experts! i have got the solution!! thank you very much!
chintugavali is offline   Reply With Quote
Old 12-21-2007, 04:05 AM   #6
Mysterious C++ User
 
Join Date: Oct 2007
Posts: 14,099
Code:
Section defGeometry::formSection( Side Section1,Section Section2,int N1,int N2,int N4,int NumberOfPoints )
{
	defFile defG;
	//std::vector Sections FinalSection;
	int NoOfPoints,i,j,k;
	N1=2;
	N2=2;
	j=0;
	k=0;
	NoOfPoints=2*N1;
	struct Section defGeomSecTemp;
	struct point x;

	double defGeompt[3];

	for(i=0;i<N4;i++)
	{
		for(j=NumberOfPoints-N2;j>=NumberOfPoints-N2;j++)
		{
			x.pt[0]=Section1.Sections[N4].Points[NumberOfPoints-N2].pt[0];
		}
	}

	return  Section3;
};
Try indenting better next time. { are reserved for the {, so don't put any code there.
Since a function is a block, indent all code inside it at least once.
And typing "struct" before the struct name is not required in C++, so you can drop it.
__________________
Using: Microsoft Windows™ 7 Professional (x64), Microsoft Visual Studio™ 2008 Team System
I dedicated my life to helping others. This is only a small sample of what they said:
"Thanks Elysia. You're a programming master! How the hell do you know every thing?"
Quoted... at least once.
Quote:
Originally Posted by cpjust
If C++ is 2 steps forward from C, then I'd say Java is 1 step forward and 2 steps back.
Elysia is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Debug Assertion Failed! IndioDoido C Programming 31 03-25-2008 11:07 AM
Visual Studio 2005 Debug Assertion Failed natmas C++ Programming 7 07-17-2007 04:28 PM
debug assertion failed ! blue_gene C++ Programming 2 05-09-2004 11:23 AM
Debug Assertion Failed! Ray Schmidt C++ Programming 3 02-21-2003 09:58 PM
Debug Assertion Failed minesweeper Windows Programming 5 12-11-2002 05:11 PM


All times are GMT -6. The time now is 06:32 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.0 RC2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22