Tuesday, February 2, 2016

Hello World! -First Programming Project.

For the first project in learning how to program C we will do a print out of Hello World. Also I am using Beginning Program with C for Dummies, by Dan Gookin to go through this project. Start up Code::Blocks http://www.codeblocks.org/ and click Create a New Project. Then double click on Console Application.



On the next screen click next, and then be sure to select C as the language we are using and not C++. Choose a location to save the file and use Hello__World as the file name. Hit next and on the following page unclick the create "Debug" configuration and continue.




On the far left there is a guide through the project just created. Double click on sources and then on the file main.c. It will open the file which is default set for Hello World. This language has a main{} function in it so that everything in it is what will run. The #include that is at the top allows for statements such the printf to work.


After seeing this code here is all correct, go to the top to the menus and go under build to build (or ctrl +F9) to build the program. This must be done for all C programs before running them. Afterwards run the program. The output will be displayed in a command prompt box.





Hitting any key will close the prompt.
Developing this code doesn't seem too hard it has similarities to others, but it is also just a simple print statement. The code would be almost the same if it were written in Java, but as the two languages are not the same I'm sure that following programs will introduce more code that is C specific and less general.























No comments:

Post a Comment