Welcome Programmers!! In this blog, The Coder is gonna tell you about how to make a good start in learning C programming language. Personally saying, it is the easiest language amongst all others. You only need a learning spirit and a consistent problem solving thinking.
The most common problem faced by the newbie programming students in that they are not able to think the solution of the problem and they quit, and finally copy the solution of others or search the internet. But in this small tutorial. We'll cover everything in C language.
Not only the syntax but also we'll focus on problem solving skills, helping you making it easy to think of alternative solutions to the same problem.
Brief Introduction to C
C is a general-purpose, procedural computer programming language supporting structured programming, lexical variable scope, and recursion, with a static type system. It was developed by Dennis M. Richie in 1972 at the Bell Telephone Laboratories to develop the UNIX operating system.
Key features of the language
- powerful language.
- Small size - C has only 32 keywords, this makes it relatively easy to learn than other languages.
- It enables users to think of problem in terms of functions/modules, where collection of these modules make the complete program.
- Structured language.
- Stable language.
- Facilitates low level programming.
Truly saying you need not learn this intro part!!
Uses of C
- Used for system programming.
- Widely used to implement end-user applications.
- Sometimes used as an intermediate language for implementation of other languages.
- Game development
- Software development
Now lets start with our very first C program....
First C program:
#include<stdio.h>
int main()
{
printf("Hello World!\n");
return 0;
}
OUTPUT OF THE PROGRAM...
Hello World!
It might seem tricky to some people who had just started this language. But trust me it is going to be damn simple when you'll study further here..
Unfolding the Various components of this program.
1. #include<stdio.h>
This weird sentence mentioned at the starting of the program is a preprocessor command. All preprocessor commands start with a '#' symbol. The #include statement tells the compiler to include the standard input/output library or header file (stdio.h) in the program. It consists of some built in functions to read, write and do other operations in the program.
2. int main()
It is the starting point of the program, from where the execution starts.
3.{}-the set of curly braces
All the statements of the program are included in these curly braces. Any line outside these braces will not be considered as a part of program, and will not be executed.
4. printf("Hello World!\n");
This is a built in function of c part of the stdio.h header file. Which tells the compiler to print the following statement on the screen, the statement which is enclosed in double quotes. There is also a '\n' character in the quotes .This is called a newline character, represented by backslash n(\n) in C. It automatically tells the compiler to add a new line. And then the statement ends with a semicolon, this is because of the fact that in C every statement ends with a ';', else an error would come up.
5. return 0;
This statement tells that the program is executed successfully by return a zero at the end.
Best books for C Programming
6. C in Depth
Nice
ReplyDeleteThank You
Delete