Click here to Skip to main content
15,506,209 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
using namespace std;
struct treeNode{
	int indexI,indexJ;
	treeNode *Right,*Down;
treeNode*Try(int i,int j,int n,int x=0);
void preorderPrint( treeNode *root );
void read(int**A,int n){
	for(int i=0;i<n;i++)>
		for(int j=0;j<n;j++){>
			cout<<"\nEnter the element["<<i<<"]["<<j<<"]: ";
void main(){
	int size;
	cout<<"\nEnter the size of the array : ";
	Array=new int*[size];
	for(int i=0;i<size;i++)>
		Array[i]=new int[size];
	preorderPrint( root );
treeNode*Try(int i,int j,int n,int x){
	treeNode*p=new treeNode;
		bool b=false;
				p->indexI=i; p->indexJ=j;
				p->indexI=i; p->indexJ=j;
			return p;
			return NULL;

void preorderPrint( treeNode *root ) {
           // Print all the items in the tree to which root points.
           // The item in the root is printed first, followed by the
           // items in the left subtree and then the items in the
           // right subtree.
        if ( root != NULL ) {  // (Otherwise, there's nothing to print.)
			cout << root->indexI << " "<<root->Right<<" ";      // Print the root item.
			preorderPrint( root->Down );    // Print items in left subtree.
           preorderPrint( root->Right );   // Print items in right subtree.
     } // end preorderPrint()

The program is throwing exceptions and I do not know why.
Updated 30-Dec-12 8:32am
Sergey Alexandrovich Kryukov 30-Dec-12 13:41pm    
This is not how it should work. Execute it under the debugger, tell us in what line the exception is thrown, exactly.
Ali++paco# 30-Dec-12 15:13pm    
dude please if u can help me .... i'm in a very f***ed up situation ..... i know it seems silly but ... i need help :'(
Sergey Alexandrovich Kryukov 30-Dec-12 19:32pm    
Strange reply. I hoped you do what I told you to do in my previous comment, but instead you complain about you situation. We say: "Saying "halva-halva" won't make your mouth sweet". If you need help, you need to help us help you.
Ali++paco# 30-Dec-12 14:10pm    
bool b=false;
in this line the "if(Array[i][j]!=0){"
the message is "Unhandled exception at 0x011F3436 in tajwal.exe: 0xC0000005: Access violation reading location 0xFDFDFE01."
hope i made clear lik that
Mattias Högström 30-Dec-12 15:52pm    
Your code is not easy to read.
Days like this I really appreciate F#.

You have a buffer overrun or underrun. you pointer arithmetic is wrong.
The sequence FDFD tells me that.
In debug mode, allocated memory is surrounded by markers, guard bytes, magic numbers.

FDFDFDFD Used by Microsoft's C++ debugging heap to mark "no man's land" guard bytes before and after allocated heap memory

Either variable i or j is out of bounds.
Hover over them and find out their values when the debugger throws the exception
Then go back in the callstack and find out why they are wrong

1 solution

hi friend if ur program has error dont mind just check the Data Structure concepts again if else i can do the same program in java and if u wish i can send u
java is best to do this work dude if u want the mlm structure contact me...
Share this answer
PrafullaVedante 1-Jan-13 23:58pm    
he he he he he .... If someone is asking you for a solution...then the code shown by him must be the part of the code ...and not whole project .... right ?? How could it possible to replace whole code of project to java .....just because there is problem in only one part of the code ....... Your solution seems most useless solution on Codeproject ...... Still i restrain myself to downvote your solution........ you made my day by giving me a joke of the day .....he he he he he

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

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