First program of C language (Hello World)
C is a powerful and widely
used programming language that can run on various platforms. It is also the
basis of many other languages such as C++, Java, and Python. In this blog, I
will show you how to write a simple C program that prints “Hello, world!” on
the screen, and explain the basic concepts and syntax of C. This blog is
suitable for beginners who want to learn C programming from scratch, as well as
for experienced programmers who want to refresh their skills. By the end of
this blog, you will be able to write your own C programs and understand how
they work. If you are interested in learning C programming, please read on and
follow the steps. I hope you enjoy this blog and find it useful. 😊
code :
#include<stdio.h>
int main() {
printf("hello world\n");
return 0;
}
This is a simple C program
that prints the string “hello world” followed by a newline character to the
standard output. Here is an explanation of each line of the code:
- #include<stdio.h>: This line includes
the stdio.h header file,
which contains the declarations for the printf function used in the program.
- int main() {: This line defines
the main function,
which is the entry point of the program.
- printf("hello world\n"); : This line calls
the printf function to
print the string “hello world” followed by a newline character (\n) to the standard output.
- return 0; : This line returns 0 from the main function, indicating that the program
has executed successfully.
- }: This line marks the end of the main function.
Comments
Post a Comment