Friday, October 11, 2024

Daily update . C programming day 1

 Hello M*F, 

There is no purpose of this blog ,

Today started learning C the BAAP of all languages so to take note or to share what I learned ,I'm writing this blog if it's helps you add comments. 

#caution(tons of spelling mistakes)

Let's begin 
day 1
time- 11:21 pm
date -11/10/2024

C is low level language much lower than any other language so far we can say after assembly language C is there AND all other languages come from C so C is BAAP/ DADDY of all language. so why c? so as it is as low as somewhat equal to assembly language we manipulate memory of out computer so we get superpower i mean we have a access of our memory directly from C. AND as we all know computer only understand 1 and 0 machine code so scientist create assembly language to give instruction to machine and again assembly language is hard to understand it's not easy and more lengthy so to make code short and easy to understand again scientist create C. so assembly is father of C.


so first syntax of DADDY . syntax means in simple language the format of how we write C code for ex. there is a format of writing English or any other language similar in coding there are format/syntax of writing code. 
#include<stdio.h>

int main()
{
        
int a;
printf("Hello MF\n");
  
}
let's break this syntax
#include so when were created coder/scientist thought to code or to add functions(I'll tell what is functions are later) or we can say different features we have to add somethings called LIBRARY so to add something they give #include means we are adding something here.

<stdio.h> here stdio.h is library so again BC ye library kya hai why we are including library. lets assume we need some information so where do we get information? In books r8? traditionally in books okay! so where do we find all sorts of book collections in library r8? I mean library is a place where we get tons of different kinda of books so we'll pick whichever we want to read. so the library givings us features of different books plus a quit place plus lights plus furniture table etc means at one place we will get all of it. The same applies here there are some codes already written in that library so we don't have to write we just take advantage of it by adding in our code.


int main() = Now what is int? it stand for integers means numbers from - to +. it's a data type as simple as data and type means a word that tells computer what type of data we are using like decimal 1.2 or int 2 or boolean true or false etc etc . main() so it is a function derived from library stdio.h as i said library feature this is one of the feature here we execute our code. so we have to write our executable code inside the main() function. oh! What is functions? well in short suppose we have to perform one code again and again and again multiple times so Instead of writing it multiple times 1000time we just create function () give them a data type like int nd all and add code in that function so whenever we want that specific code we just give a call to that function rather than write it again. simple!

{} =  two curly braces are the body of that function, so function only execute code which is written inside of the curly braces.

printf("") = again printf() is a function it is from the library again code is hidden in the library which tells printf() function to print statements/sentences written in your function inside "" double quotation.. so printf() is for print statement/sentences.

\n = is for new line 








No comments:

Post a Comment