Tree using preorder and inorder

getting fault

HELLO @guptashubham210a
in this question there was very silly mistake .
i have marked the mistake and changed that .
now i think you can do the printing part by youself and can submit it .
i hope i have cleared your doubt …
Happy Learning !!

@tusharaggarwal272
getting fault again

@tusharaggarwal272
ok

hello @guptashubham210a here is the link for the corrected code https://ide.codingblocks.com/s/318439.

@tusharaggarwal272
where the mistakes was in this code?

i have commented the errors in your code .
it was a silly mistake when you were taking the input in main function for the inorder array you were defining it of size m before taking the m as input .
this was the error .
there was one more error when you were in function you were passing ‘int i=0’ inside the function only .
you should declare it outside the function and then do the increment in the function …

i hope i have cleared your doubt .

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.

@tusharaggarwal272
but that was static var na

yes right @guptashubham210a but the error was due to the declaration of array before taking the input size of that array .
that why you were getting that error .
i hope you have understood .
just make the change there and you will see that your code will run fine .

@guptashubham210a try to think yourself as well how can you give array a size which is yet not defined it will surely give you error only .