|
-
November 6th, 2012, 06:01 AM
#1
crash caused by a 2D array
Hi All,
I have a function such that one of its parameters is a 2D array of type int. The parameter is defined as follows:
[code]
int topoGraph [][MAX_VERTICES]
[\code]
However, the following code snippet from the body of the function crashes at the specified line:
[code]
if( counter >= 4 && !adjMatrixAlreadySet)
{
if( edgeCost == 10 )
{
topoGraph[srcVertex][dstVertex] = 1; <<<<<---------- The point of crash
}
else if( edgeCost == 100000 )//restricted link
{
topoGraph[srcVertex][dstVertex] = edgeCost;
}
else if( edgeCost == 300000 )//isolated link
{
topoGraph[srcVertex][dstVertex] = 0;
}
else{}
adjMatrixAlreadySet = true;
totalEdges++;
}
[\code]
It seems like there is an undefined behaviour at the specified point of crash since it crashes with different values of srcVertex and dstVertex each time I run it.
What might be the reason for this crash ?
Thanks.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|