Tuesday, October 10, 2017

First Program


C – Programming Basics


If you are looking for C programs,
This C programming basics section explains a simple “Hello World” C program. Also, it covers below basic topics as well, which are to be known by any C programmer before writing a C program.
  1. C programming basic commands to write a C program
  2. A simple C program with output and explanation
  3. Steps to write C programs and get the output
  4. Creation, Compilation and Execution of a C program
    * How to install C compiler and IDE tool to run C programming codes
  5. Basic structure of a C program
    * Example C program to compare all the sections
    * Description for each section of the C program
  6. C programs ( Click here for more C programs ) with definition and output – C program for Prime number, Factorial, Fibonacci series, Palindrome, Swapping 2 numbers with and without temp variable, sample calculator program and sample bank application program etc.

1. C programming basics to write a C Program:

Below are few commands and syntax used in C programming to write a simple C program. Let’s see all the sections of a simple C program line by line.
C Basic commands Explanation
#include <stdio.h> This is a preprocessor command that includes standard input output header file(stdio.h) from the C library before compiling a C program
int main() This is the main function from where execution of any C program begins.
{ This indicates the beginning of the main function.
/*_some_comments_*/ whatever is given inside the command “/*   */” in any C program, won’t be considered for compilation and execution.
printf(“Hello_World! “); printf command prints the output onto the screen.
getch(); This command waits for any character input from keyboard.
return 0;
This command terminates C program (main function) and returns 0.
}
This indicates the end of the main function.

2. A simple C Program:

Below C program is a very simple and basic program in C programming language. This C program displays “Hello World!” in the output window. And, all syntax and commands in C programming are case sensitive. Also, each statement should be ended with semicolon (;) which is a statement terminator.

Output:

Hello World!

No comments:

Post a Comment

Featured Post

Increase Your Laptop s Wifi Signal Faster