(Beginner's Guide) Learning to Program with C: Introduction to programming #0

in #programming7 years ago

Hello Future Programmers, In this blog, I am going to introduce you guys to the world of programming . I will try to make this tutorial as simple as possible and try to give you the basic concepts of Programming.

You're only eight? Don't Worry Follow Along With It.

getstarted.jpg

So What Is Programming?
.....................................................................................................................................
I define programming as talking with the computers. Its That Simple. But, there is one catch, as a spanish guy/girl cannot understand Russian(unless they are taughed to do so ) , Computer also do not understand your native language. There are only a bunch of language a computer can understand( and yeah computers can also be taught ), these languages are what you call a programming language for eg you might have heard about Java, Python, C, C++, Ruby, R etc

So, informally speaking( I don't like to be formal ) programming refers in general as giving a computer( or any machine )a set of instruction inorder to do a certain task. For example: you want your computer to print your name on the screen, there you go give some instruction to it in the language it understands (Here In C )
like: printf("igaurab");
This prints igaurab on the screen

If you are like what f (" ") and ; is doing there? As I've told you earlier it's computers language, They are written in a discliplined way, and often reffered as syntax ie.
If i say print(igaurab) , it says syntax error because the printf() function is designed to use in a specific manner. We will come to this a bit later. And also note different programming languages have different syntax for the same function like we say apple in english and Pomme in French for the same fruit( Btw Apple just launched iphoneX )

.......................................................................................................................................

So What are Functions?
I hope many of you are familiar with this term, but for some of you who are absolutely new to maths,you might wanna know what a Function is cause you will be needing this. Actually, you guys already know what a function is but in maths they define in such a way that you forget it. Agree? :D

function.jpg

This is the mathematical representation of a function. f( x )
Here ( x ) is something you pass on to the function. Its like posting a photo on your facebook. You give your photo to the facebook( ie x ) and the facebook does something and displays your picture to the audience that you defined.( and yes defining audience is also the input. And yes a function can take more than one input. No, f doesn't stand for facebook).

Lets get our hand dirty and define a function that can calculates the sum of two numbers.

let us call our function as addFunction(n1,n2) where n1 and n2 are two numbers you can give
lets say you give 1 and 2 to the function ie. addFunction(1,2) it will return 3. Lets see what is going under the hood
addFunction(n1,n2)
{
sum = n1+n2
return sum

}
so what it is basically doing is adding two numbers you provide and returning the sum. How Simple Is that !!
(Note the { } are known as curly brackets and are used to denote the opening and closing of the function) This is not a C program though. The logic is the same but as we have discussed, we must follow specific rules( you mean syntax right? -- Yeah! ) while talking with computers.

This is just a demo there are lot more things you can do with functions.
.....................................................................................................................................

Basic Requirement For The Next Blog:

  1. As I've said programming is just talking with computers. But is it through microphone or it has a number?
    No, we actually talk with it by writing. It is like chatting, so for that you need to have a text editor where you can type like
    notepad .

  2. Also, we know that computers are binary, ie they only understand 0 and 1 ( Actually, 0 stands for 'off' ie no current or voltage
    is passing through the circuits inside and 1 stands for 'on') This is how they perform all thier task. So, inorder to convert that
    language to the 0's and 1's which machine actually reads, we need something called a 'compiler'.

  3. To wrap up you need to have a program called codeblocks which contains both of it.

    And yes you need to learn how to use this awesome website called google.(Btw dont know where to get codeblocks, you can always google it).

last.jpg

Note: Image Source Google
............................................................................................................................

Thank you for giving your time to read this. Meet you guys in the next blog. Hope you like it
And Congrats! from today you have got a new friend to talk with ;)