Anda di halaman 1dari 2

To C program in Ubuntu, follow the following steps: 1. Click on Places on menu bar > go to Home Folder. 2.

A new window appears containing folders like 3. Here rightclick on your mouse button > Create Document > click on Empty File. 4. Select the file > press F2 > rename it as neilay.c. 5. Double click on neilay.c. 6. There you type the simplest C Code: #include<stdio.h> int main() { printf("Neilay from India\n"); return 0; } 7. Save and minimize everything. 8. Click on Applications on the menu bar > Accessories > click on Terminal. 9. A new window appears and since my username is neilay, neilay@ubuntu: ~ appears on its title bar as default this will be different in your case. 10. Now neglecting everything, just type: gcc neilay.c and press the Enter key. 11. Wait and if your code is correct no error will be found and simply neilay@ubuntu: ~ $ will be appeared and indicates you can execute this compiled file. 12. Now type: ./a.out and press the Enter key and see how nicely your file is executed! 13. This procedure must work with both Ubuntu and Fedora. If it is not working, then definitely your OS has got problem with it. This happened to me too. Earlier my friend gave me a pirated CD of Ubuntu and there this method failed. Later if ordered for a Ubuntu CD for free and when it came I installed it onto my hard disk and got the above procedure is working correctly. I don't know why! And if no input files error appears while executing, make sure that you have placed your source file in appropriate folder or location. For me neilay@ubuntu: ~ appears on the title bar of the terminal I have simply placed the file in neilay folder

14. That's all about Ubuntu C Programming. If it works nicely as well as you got problem with it, kindly feel free to drop a comment. Happy programming!

Anda mungkin juga menyukai