I have worked with galileo gen2 using node.js as well as C.But when I power it off and on immediately, the node.js program automatically runs but the C program doesn't.
Also another problem I have encountered with eclipse IDE is that when I disconnect a particular galileo from the IDE, the program also stops running.
Any reason why this happens?
The reason why the script (uploaded with Eclipse) stops working is because it is stored in a temporary directory, called /tmp. Every time the board boots this directory is cleaned.
If you use the method I described above you won't need to use Eclipse. That way you will be able to run your scripts directly from Linux. They shouldn't be affected if you disconnect the board from the PC. As long as your board is powered the script should run.
I personally like to work directly from Linux better. I usually use an IDE (Arduino, XDK, Eclipse...) when prototyping a script but when it is ready, I believe the best option is to work with them directly from Linux since you have more control over the process that way.