There are quite a few errors which you should be rectifying.

1. inData variable is defined more than once
2. You have defined the for loop of the hex conversion outside the main function.

Thanks
Shabbir