Welcome to DotNetsExpert, where we dive into the world of C programming. Whether you’re a beginner or have some coding experience, this post will guide you through the essentials of C. . Watch the video to kickstart your programming journey with C and gain valuable skills . In this I have explained about how you can create your first C Program.
The following guidelines, which apply to all C programs, should be kept in mind before we start writing our first C program:
- Every instruction is written as a separate statement in a C program. A complete C program would therefore consist of a number of statements.
- A program’s statements must appear in the order in which we want them to be executed, unless, of course, the logic of the program requires a purposeful “jump” or transfer of control to a statement that is out of order.
- To make the phrase easier to read, leave a blank space between two words. A variable, constant, or keyword, on the other hand, cannot contain any blank spaces.
- All statements are typed in lowercase.
Basic Program of C
#include<stdio.h> void main() { printf("Hello World!"); }
- Using the preprocessor command #include, the compiler is instructed to include the standard input/output library. We may display output on the screen using this library’s functions like printf().
- The program’s entry point is void main(). The main function, which acts as the program’s entry point for execution, is a need for all C program. The Void symbol before main denotes the function’s return nothing.
- The boundaries of the main function are specified by the opening and closing curly braces. These brackets include all of the code that is related to the main function.
- The function call printf(“Hello, World!n”); sends the message “Hello, World!” to the console.
The output “Hello, World!” will be seen on the screen when you construct and run this program. It’s a straightforward but essential step in learning C programming.
Now a few useful tips about the program….
- Comment in C program should be enclosed within /* */.
- Though comments are not necessary, it is a good practice to begin a program with a comment indicating the purpose of the program, its author and the date on which the program was written.
- Any number of comments can be written in C Program. For example, you can write comments before the statement or after the statement as per your need
//This is a single line commment /* this is a multiline comment*/ #include<stdio.h> void main() { //Print Hello World printf("Hello World Again"); }
check out the accompanying video for a hands-on experience.
Want to know more about C Language :
How to download and install Turbo C++?
What is loop in C language ? Types of loops?
Documentation of C Language
Please view the below video to see the program in action and to better understand the ideas we covered. You are welcome to play about with the code, make modifications, and then analyze the results.
Now it’s your turn to take the leap and start coding. Embrace the power of C, and let your imagination and creativity flow through the lines of code. Happy programming!