sorry, ok i see more weird things here.
x is declared in main() AND passed to your sin(...) function, yet in your sin(..) function as stated earlier, you are assigning a different value to x.
you should redesign the entire thing and post back, itll make it easier for me to help you.
ill even...