Skip to main content

C Programming - 4.1 First C program

First C program


#include <stdio.h>

int main()
{

     printf("I am a Programmer\n");

     return 0;
}


Output: 
                  I am a Programmer


In the next tutorials, we will understand this code point by point.



Semicolon Issue


we have to remember one important thing always

end of every statement in C we have to put a semicolon

From the first code, there are two statements

       printf("I am a Programmer\n");
       return 0;

and both of them have a semicolon at the end of the line or statement

Some people find this annoying 😒 but like it or  not we have to be careful about this


Happy Coding
See you in next tutorial


Next Post:


https://coderavens.blogspot.com/2018/05/c-programming-42-main-function.html

Comments

Popular posts from this blog

C Programming - 4.3 Header Files

Now, again see the first C program I wrote #include <stdio.h> int main() {      printf("I am a Programmer\n");      return 0; } Now, what #include <stdio.h> means actually  Here, stdio.h known as a Header file 😮, remember it's not studio.h 😜 . So many persons done that mistake when he/she first write C codes And, the coolest thing about header file is, it will give you a headache 😨 OK, I am just kidding  Header file term refers to that kind of file which contains C function declarations and macro definitions. A C header file contains .h extension. Like in this code stdio.h contains function declaration and definition of printf() that's why we had to include the  stdio.h  header file at the top of the code The basic syntax of including header files on top of the code #include <header_file_name> Now, you can wonder about printf() function, don't worry we will lea...

C Programming - 4.2 The main() function

The main() function is the entry 🔑 point of a C program Now look at the code what I wrote #include <stdio.h> int main() {      printf("I am a Programmer\n");      return 0; } OK, I wrote, int main() here "int" represents the Integer number is, an Integer number is a whole number not a fraction one like 1,2,0,10,55 etc. now, the question ❓ is- Why I wrote int main() We all know mathematical function right. for example :                         f(x) = bx+c this function  f(x)  has a return value, let's say it's Integer , then for C it is int C functions are quite similar to mathematical functions , the basic format of a C function is return_type function_name() { } by writing int main(), we indicate that this main() function will return an int number. that's ...