Can't get "return()" to work.Problem in "if" part

This is a discussion on Can't get "return()" to work.Problem in "if" part within the C Programming forums, part of the General Programming Boards category; hi,
My program's all function are running fine except the "position()" function.In this function i have some problem in if ...

That code won't even compile, so you shouldn't even be able to get output from it.

Try deleting the object and executable files, and rebuild from scratch. If using an IDE, do a Build/Clean before a complete rebuild.

Then correct the compilation errors before trying to run it.

Your basic problem is that all your functions need to be declared before code that uses them. If you don't do that, the compiler makes assumptions about what the functions are (what arguments they accept, return type). The assumptions are different from the actual functions.

If you're going to use math functions (sqrt(), pow()) it is necessary to #include <math.h> first.

Also, x*x is usually considered a better approach to computing x squared, than pow(x,2).

If I seem grumpy or unhelpful in reply to you, or tell you you need to demonstrate more effort before you can expect help, it is likely you deserve it. Suck it up, Buttercup, and read this, this, and this before posting again.

thank you ,i did what you said and it worked .But couldn't pin point what was the main problem "the math.h library" or "the declaration" or "the previous object file"
but hey its working ,thanx a lot for the quick reply and if you can make the program shorter or more efficient let me know.
My new code :

Thank you for your reply. .however i am not sure my program is working properly.
i gave input of first three points as : (1,4),(5,7),(9,4)
And it only gives "1" as return when point is (5,7) or (1,4) or (9,4)
and for others its 0 as return value.cant figure out what is the problem (bytheway i corrected that declaration part and q part)

That's correct; ie. the OP's formula is not correct. 1/2(b/h) would be ok for a right triangle but not general triangles.

There's a few methods for calculating the area of a triangle including the one you've quoted, but I'd probably use one of the methods that don't involve a square root, therefore avoiding the math libraray as well as complicated calcuations. I think that if I were the op I'd got with the so-called "shoelace formula" mainly because it can be easily extended to compute the area of any polygon -- not just triangles. Using this method/formula and the coordinates (ax, ay), (bx, by) and (cx, cy) the area of the triangle is: