C programming

                   Friends, Today I will explain the code which I have given in the last post. Understanding any code needs some basic skills, and generation of such skills is quite simple. Let's start the discussion.
                   The code for addition for two numbers is as follows.
#include<stdio.h>
void main() {

int A=2,B=3,C; // Initialisation
C=A+B; // Addition
printf("Output is %d",C); // print the output

}

#include<stdio.h> :- This line indicates inclusion of standard input output (stdio) library. As an example, for science side, there is an library in which there are several books like mathematics, electronics, biomedical, and so on. At the end, my point was this line includes some built in functions which are already provided with the compiler.You will get to know what is actual function of stdio in upcoming discussion.

void main() :- This instruction indicates, the main function is started. Again you will get to know the working of main function very soon. The "( )" indicates we are not passing any argument in the main function. Please do not worry about word argument,  you will come to know it in upcoming discussion. The { braces indicates the instruction under the function. Here" main ( ) {" is used , so in this case { indicates instructions are in main function.

int variable1, variable2,etc: This indicate we are declaring variables of type integer. This process is called as "Initialisation".

C=A+B : This simply indicates the addition of two numbers is going on. Please note that this process is not associative, i.e. we cannot write instruction like A+B=C . 

printf("----") :- As we have included standard input output library, printf is a function. Now you may raise a question that how to recognize a function in programming, the answer in rough words can be- any keyword when ends, there is (.....) pattern is used. In after the word printf we used ("Output is %d",C). So whatever is written in printf("...."), the word in "--" double quote will be printed on the output screen.

 As I have given this program as example, I won't directly touch the programming side too early. This program was just given as per the algorithm. So for any program, at the basic level, the algorithmic point of view is necessary.

After the termination of this program, you will find output in the following screenshot.

Now you have new facility that, even if you have any difficulties, you can contact me through C Programming tab , in which there is an forum, so you can discuss it there. Also I have given the sample code there.
      Thank you.

+++++++++++++++++++++++++++++++++++
You are always both the student and Teacher. Learn, Grow, Share.
                                                  -Unknown 
+++++++++++++++++++++++++++++++++++
 


No comments:

Post a Comment

Share English German French Arabic Chinese Simplified