Code compilation help needed .

i have downloaded all the demo code in C but no clue how convert them in HEx,

You don't convert them your compiler converts them.

I am not sure if the arduino compiler will produce the right code, but to get a hex file from it:-
There is an option you can add to preferences.txt to tell Arduino to NOT delete the files. I think it's:
export.delete_target_folder=false
You then set build output to 'verbose' to get the name and location of the temporary directory.