C programming is an imperative procedural language. It was designed to compiled using a relatively straightforward compiler and it also provides the access to memory to provide language constructs to follow the machine instructions.
In this section, you will learn how to start with c programming and also I will explain this by using a simple and easy example program which prints the “Hello World”. Apart from this, you will also learn the below things:
Below are the basic commands of C programming language:
#include
int main(): Main function, from where execution of C program begins.
Follow the below steps to compile and execute the C programs.
Step 1) Go to the path where you have saved your C programs.
Step 2) Assume you have saved your C programs in D drive, then run this command to compile your program D:\C Programs>tcc hello.c
Step 3) After execution of “tcc command”, just type the program name and hit the enter button.
D:\C Programs>hello
Hello
1 2 3 4 5 6 7 8 | #include <stdio.h> int main() { /* Our first simple C basic program */ printf("Hello World! "); getch(); return 0; } |
Output:
1 | Hello World! |
Below program will take input from the user using scanf and print while program execute.
1 2 3 4 5 6 7 8 9 10 11 12 13 | #include <stdio.h> main() { int number; printf("Please enter an integer\n"); scanf("%d",&number); printf("You have entered number is: %d\n", number); return 0; } |
Program output:
Enter an integer
50
Integer entered by you is 50
Below is the list of recommended c programming books for the beginners.
If you like FreeWebMentor and you would like to contribute, you can write an article and mail your article to [email protected] Your article will appear on the FreeWebMentor main page and help other developers.
Article Tags: beginners, c, example, interview questions, language, professionals, programming, tutorial, what is c programming