This is "Hello, World!" program in C programming language.

4 min 23 sec read Basic


There might be two reasons you have landed on this C tutorial for beginners.

1) You might want to explore the basics of C programming.

2) You are looking to write your first hello world program in C.

Trust me learning C programming is the best decision you have ever taken in your life. The skills you need to become the best computer programmer in this world start with C programming. C programming is also called as "Mother of all languages".

We will guide you through each and every concept step by step.  Okay, So lets begin with the very basic C program. Most programming languages like C++, Java adopts syntax of C language. That's why C programming is also called as the mother of all Programming languages.

Basic Syntax


/* Preprocessor Declaration */
/* Main Function */
returntype main() 
{
program statements to be executed.
} 

1) Preprocessor Declaration: This section includes all the necessary libraries required in our C program. These libraries include many functions which we can use in our program and this also makes the life of developers easy.

2) main(): main function is the entry point of the program.

Example :-

Let's write our first hello world program in C which illustrates the syntax of C programming.

/* Hello World program in C */
#include 
int main()
{  
printf("hello world program in c");  
return 0;  
}

Comments

Comments are used to describe the purpose of statements in the program. It is the best practice to include comments every time you write the program. Suppose there is a team of 20 developers in a company which is working on the same project. Then each and every developer should understand what you have written in your code. This is how comments can be useful in live projects.

/* This is a C Comments Statement */

Example:-

/* C First program Comment */

#include 

/* Main Function 
void main()
{ 

/* Print the Hello world */ 
printf(" hello world program in c ");  
  
getch();  
}  

What are Identifiers in C?

A C identifier is a name used to identify a variable, function, or any other user-defined item. An identifier in C starts with a letter A to Z, a to z, or an underscore '_' followed by zero or more letters, underscores, and digits (0 to 9). C programming does not allow punctuation characters such as @, $, and % within identifiers. C programming is a case-sensitive programming language. Thus, Programming and programming are two different Identifiers in C.

abc , _abc , abc_123 are valid tokens
whereas,
$abc,#abc,abc$ are not valid tokens . 

I hope you have now a better understanding of how to write your very first Hello World program in C.

 

Codzify's

1:1 & 1:Many Mentorship Program

Be job-ready. Learn how to crack the interviews with industry ready training program.


Learn More

Data Structures & Algorithms

What is Dynamic Programming and how to use it

This is a quick introduction to Dynamic Programming.

3 ways to check anagrams

Let's discuss the 3 ways to check anagrams and their time complexity.

Bubble Sort Algorithm

Topics covered: 1) Basics of Bubble Sort Algorithm 2) Worst Case, Best Case complexity

Introduction to Trees

What is a Tree and Terminologies like root, sibling, parent node, children, Leaf node, Ancestor & Descendant, Properties of Tree Data Structure, Depth of node, Height of node

Address Calculation in 2d array

Let's discuss about the Address Calculation using row-major order & column-major order.

Javascript

Javascript - Postfix Vs Prefix

Let's discuss the difference between postfix and prefix with a practical example.

Javascript Identifiers, Variables

In this session, we will discuss the concept of identifiers, variables and operators in javascript with a practical example.

Bootstrap

Bootstrap 4 Tutorial: Modal Popups Made Easy | Live Demo

Let's discuss the Modal Popups in Bootstrap.

How to create a dropdown list in navbar bootstrap

In this video, we will discuss How to create a dropdown list in navbar bootstrap with a practical example.

Navigation tabs in Bootstrap

Let's discuss about the navigation tabs in Bootstrap

Bootstrap Buttons

Let's discuss about the button classes in bootstrap.


Recommended tutorials