"Hello, World!" program:-
Introduction of C language :
C is a general-purpose programming language that was developed in the early 1970s at Bell Labs by Dennis Ritchie.
Example of "Hello World!" (Code):-
#include<stdio.h>
int main() {
// Display Hello world
printf("Hello World!");
return 0;
}
How will start for program writting
Preprocessor Directive (#include):-
This line includes the header file stdio.h, which stands for "standard input-output." It provides functions for input and output operations like printf and scanf.
Function (main):-
program starts executing from the main function. It's the entry point for C programs. The int before main specifies the return type of the function, which indicates whether the program executed successfully (returning 0) or encountered an error.
Output (printf):-
The printf function is used to display output to the console. In this case, it prints the "Hello, World!" message followed by a newline character (\n), which moves the cursor to the next line.
Return Statement:-
The return 0; statement indicates the end of the main function and the successful execution of the program. A non-zero return value typically indicates an error or abnormal termination.
Comments:-
Comments are used to explain the code to other programmers and to make the code more understandable. In this example, I've added comments to explain the purpose of each part of the code.
Semicolons (;):-
Semicolons are used to terminate statements in C. Each line of code in this program ends with a semicolon.
Thank you for access this study material. All things are free to all. I will see you next time.
If you have any queries please feel free and send me comment i will give my 100% to solve your problem.
Comments
Post a Comment