First C program

 

Most C programs are in lower case letters.

You will usually find uppercase letters used in preprocessor definitions or inside quotes as parts of character strings.

C programming language is case sensitive, that is, it recognizes a lower case letter and its uppercase equivalent as being different.

All program statements in c must be terminated by a semicolon.

First C program

#include < stdio.h >

int main()

{

printf(“hello world\n”);

return 0;

}

A c program whatever may its size, consists of functions and variables.

A function contains statements that specify the computing operations to be done and variables store values during the computation.

Let’s take a look at our first C program.

main is a special function that every program begins executing at the beginning of main.The open and closed

The open and closed parentheses immediately following main specify that no arguments or parameters are expected by this function.

int main() tells that the return type of the main function is of type int.

{ } – The 2 curly brackets are used to group all the commands together so it is known that the commands belong to main.

These curly brackets are used very often in C to group things together.

If a line starts with a hash, denoted by # is expanded by the preprocessor.

#include tells the compiler to include the information about the standard input/output library.

printf function simply prints or displays its argument at the terminal.

\n -(newline character) tells the compiler to print a newline as part of the output.

return 0;

The int in int main() is short for an integer which is another word for number. We need to use the return command to return the value 0 to the operating system to tell it that there were no errors while the program was running.

The text between the /* and */ is ignored by the compiler.

 

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: