C programming is a language developed by AT & T’s Bell Laboratories of USA in 1972. C programming was designed and written by a man named Dennis Ritchie. C programming is reliable, simple and easy to use. C has survived for more than 3 decades. C programming language is a base to learn different programming language. If you want to learn C++ or JAVA, without the knowledge of C programming it becomes very difficult to learn these programming languages. Many major components of popular operating systems like Windows, UNIX, LINUX is still written in C. Nothing beats C programming in...
Category: Fundamentals of C Programming
A constant, Variable or a keyword in C programming can be formed from any combination of Alphabets, Digits and Special Symbols. A constant in C programming is an entity whose value does not change throughout the program execution. A variable in C programming is an entity whose value keeps on changing throughout the program execution. However, it’s not a rule that the value of the variable will change. A variable value might remain same throughout the C program execution. However, the main difference between variable and constant is that we can’t change the value of constant in between the program,...
3) Addition of two numbers
5) //Here it starts
8) Void main()
10) int a, b, c;
11) /*Assign the values to the variable a and b */
12) a = 5;
13) b = 4;
14) /*Perform addition of a and b */
15) c = a + b;
16) printf(“\nAddition of a and b is %d”, c);
Let us learn the above program in detail. Line 1 thru 4: This is the comments in the program. It is called multiline comment. The text written within /*…*/ are ignored by the compiler. Line 5: This is another way to comment a text or statement. It is called single line comment. The entire line following the tag // is ignored by the compiler. Line 6 and 7: #include is known as pre- processor directives. It tell the compiler to include text from another file, stuffing it right into your source code. is a file name enclosed within angle...
sizeof operator in C is an unary operator which can be used to find the size of the data-type or expression or a variable. It returns the size of the memory allocated (in Bytes) by the compiler. Lets say, we want to find the size of the memory allocated to the data-type int. We can find it by using sizeof operator as shown in the below code:
sizeOfInt = sizeof(int);
printf("%d Bytes", sizeOfInt);
As you can see, the above code calculated the size of int data type and displayed the result.