Skip to main content

Posts

Showing posts from July, 2016

The Basics Of C Programming - Part 1.

Your first program is going to do is print the message "Hello World" on the screen. The program is a short one, to say the least. Here it is: #include <stdio.h> main() { printf("Hello World\n"); } The first line is the standard start for all C programs - main() . After this comes the program's only instruction enclosed in curly brackets {} . The curly brackets mark the start and end of the list of instructions that make up the program - in this case just one instruction. Notice the semicolon marking the end of the instruction. You might as well get into the habit of ending every C instruction with a semicolon - it will save you a lot of trouble! Also notice that the semicolon marks the end of an instruction - it isn't a separator as is the custom in other languages. If you're puzzled about why the curly brackets are on separate lines I'd better tell you that it's just a layout convention to help you spot matching b