C Programming is considered as one of the best and easy to learn programming language. C programming was introduced many decades ago and still it is one of the most popular languages in the programming world. When I started with programming, I had a question in mind – How to learn programming? There were many programming languages available for me to start with, like C, C++, Java, C# and so on. To be frank, I had started with Java programming. Initial few says were awesome. Started with an introduction to Java, then started with java basics which included statements, loops,...
Learn C Online
Learn C in just 2 days. Guaranteed...
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...
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...
We will write a program in C that will accept a string from the user and write the string in a file. In this program, we will use fopen function in order to open a file. We will also use fputs function which will write a string to a file. Below is the program:
//Open the file in write mode
fp = fopen("write.txt", "w");
printf("Enter a string: ");
//write string in a file
C Programming is brought you by LearnCOnline.com