Introduction to C Programming
🤔What is Programming ?
Providing clear instructions to the computer to perform specific operations. Programming is the process of instructions that tell a computer how to perform a tasks.
Different Programming Languages 💻
C,C++,Java,Python,Kotlin,Javascript,Ruby,Typescript,C#,etc.
What is C Programming?
C is a general-purpose programming language. C programming was created by Dennis Ritchie at the Bell Laboratories in 1972.
🤔What is Compiler?
A compiler is a software program that converts source code written in a high-level language into low-level machine language.
💻 Example 1 :
#include <stdio.h>
int main()
{
printf("Hello world!!!");
return 0;
}
⚙️ Output :
Hello world!!!
Program Explanation:
Line 1: #
defines path directory include
means add .h
defines header file. Header files means code. <stdio.h>
stands for
Standard Input Output.
#include <stdio.h>
support input output file like printf() and scanf(). printf( ) function display output on screen scanf() function take input from user.
Line 2: int
means return type of your function. main()
it is the first function of every C program that is responsible for starting the execution and termination of the program.
Line 3: {
is used to start of the function.
Line 4: printf ("Hello world");
printf()
is a function used to print output text to the screen. Our example output is "Hello World". ;
semicolon used to terminate any statement.
Line 5: return 0;
return 0 means that the program will be executed successfully.
Line 6: }
closing curly bracket is used to end the main function.
💻 Example 2 :
#include <stdio.h>
int main()
{
printf("Hello Students👋");
printf("Are you interested in ICGP?");
return 0;
}
⚙️ Output :
Hello Students👋 Are you interested in ICGP?
Example 3 :
#include <stdio.h>
int main()
{
printf("My name is Suraj.");
printf("I love teaching.");
printf("I write code.");
return 0;
}
⚙️ Output :
My name is Suraj.I love teaching.I write code.
New Line Character
\n
is a newline character. \n
is used for create a new line or break a current line.
Example 4 :
#include <stdio.h>
int main()
{
printf("My name is Suraj.\n");
printf("I love teaching.");
printf("\n I write code.");
return 0;
}
⚙️ Output :
My name is Suraj. I love teaching. I write code.