C Programming for Beginners

Lets get Started – Introduction to C Programming

Introduction to C Programming

Introduction_to_C_Programming

Video content of Introduction to C Programming Season 1, Chapter 1 Can we found at Amazon, YouTube.

In this series you will be learning C Language. Before we get started we need to answer two basic questions

  1. Why we need to learn any programming Language ?
  2. Why C Language ?

Reason  to learn any programming Language ?

Suppose you have a new friend or office colleague and you ask him what is 5 multiplied by 9.

It’s simple, anyone can answer that. But suppose your friend only understands German and doesn’t understand any other language. Then you have a problem. He won’t be able to answer you anything.

What I mean to say is, if you want to ask anything to anyone, you should know their language. Only then you will get a correct and fast output.

The computer is your smartest friends and if you want your work done, you should understand the language of the computer. You should know at least one language which computers understand easily.

Only then can you place your queries into computers and get a better output. So now you know the importance of Computer Language.

Why C Language ?

Let me tell you why C Language is a must. Doesn’t matter which software you want to develop , which company you want to work, you will have to learn C language if you want to become a software Developer.

You can learn anything, there are many languages like Java, Python, Ruby, C Sharp etc.

There are also many high end courses like Android, IOS Development, Blockchain, Artificial intelligence, 3D Printing, Web Development, Node Js etc. The list is limitless. Don’t worry we are creating series on all these languages. But still C is must have for you.

Though there are 1000 reasons for you to learn C language, let me explain a few of them.

Programming for computers is based on very basic key concepts

  • constants,
  • variables,
  • loops,
  • arrays,
  • structures and many more.
  • These concepts are best explained in C Language. If you don’t understand these concepts you won’t be able to learn any other computer language. So to understand the basic concepts you must learn C Language.

Another important reason, if you use windows or mac or any other operating system, many of the components of this operating system, specially drivers are developed in C.

So we can say that whatever operating system we use is based on the C language.

Have you seen a Washing Machine, Fridge, Car or any other simple electronic hardware? I guess yes. You have all this in your home. All of these have micro-controllers in them and all these have been developed in C Language.

Being light and low memory requirements make C Language ideal for such type of devices.

Hope now you understand the importance of C

Now, let’s start the journey of C

Before understanding C or writing any program in C, it’s a must to have the tools, where we can write our C program and then a computer that will run that program.

There are many tools available to run the C programs like Turbo C, Code Blocks, Visual C++, Netbeans, Microsoft Visual C++ etc. Turbo C being very light and most popular, but its outdated for the latest operating systems like Windows 8 and 10. So we can’t use it

So our best choice is Code Blocks. Its very light weight and it can run on Mac, Windows or Linux doesn’t matter which operating system you are using. You can download it from here “https://newtum.com/material/c-language” The link is also available in the description.

Before understanding any further theory, let’s start the execution. First Install the Code Plus.

First Hello World Program

We will write our first program to write hello world example. Its simple

Write main , followed by two curve brackets in hello.c file. User curly brackets {} ,

Inside the curly brackets write following line. Don’t change anything,

main()

{

printf(“Hello World”);

}

If you want to copy paste the code please refer our Newtum Github repository link over here.

Using \n in the C Program

Lets learn a bit more in Print Statement. Now you know whatever is written in printf statement, its output is given  in a black output screen.

Printf statement accepts special characters which are not printed as it but something else is printed at that place.

So for printing next line we will use a special character is slash n Lets update the program and execute it again.

Now see the output. Printf prints everything as it is except for some special characters.

main()

{

printf(“Hello World”);

printf(“\nHello World”);

}

You can view the source code from Newtum github repository  link over here.

Display Value of Expression

Look at another program. Here we have written the same thing, like main, curve brackets and printf with semicolon. All enclosed in the curly brackets

But the only different is printf statement. Here we have written %d in double quotes and after comma we have written 9 multiply by 5. Lets run this program.

main()

{

printf(“%d”,9*5);

}

Output :

45

Oh!. We got the answer and it was not printed as it is.

Let’s modify the printf and now write 3+4, again build and run. Again you will get an answer.

main()

{

printf(“%d”,3+4);

}

Output :

7

So here we learn printf can display value of any expressions.

There is only one thing in this program %d , which is called as placeholder for integer. We will study more about integer, variables constants etc but in next chapter.

 

Facebook Comments
(Visited 1 times, 1 visits today)