C/C++ program to print Hello World without using main() and semicolon Last Updated : 12 Jul, 2025 Comments Improve Suggest changes Like Article Like Report The task is to write a program to print Hello World without using main() and semicolon. As we already know, how to print Hello World without the use of a semicolon. Now, for writing without main() method, we will need a Macro. C // C program to print Hello World // without using main() and semicolon #include <stdio.h> #define x main void x() { if (printf("Hello World")) { } } C++ // C++ program to print Hello World // without using main() and semicolon #include <bits/stdc++.h> using namespace std; #define x main void x() { if (cout << "Hello World") { } } Output:Hello WorldC/C++ program to print Hello World without using main() and semicolon Time Complexity: O(1)Auxiliary Space: O(1) Comment More infoAdvertise with us Next Article 500+ Keyboard Shortcuts List (A to Z) with Free PDF Download: Ultimate Guide V Vishesh__Jha Follow Improve Article Tags : C Programs C++ Programs Computer Science Fundamentals c-input-output cpp-input-output +1 More Similar Reads C Programs To learn anything effectively, practicing and solving problems is essential. To help you master C programming, we have compiled over 100 C programming examples across various categories, including basic C programs, Fibonacci series, strings, arrays, base conversions, pattern printing, pointers, and 8 min read 500+ Keyboard Shortcuts List (A to Z) with Free PDF Download: Ultimate Guide Unlock the full potential of your computer with our 500+ PC shortcut keys list, designed to streamline your workflow and save you time. Whether you're working in Microsoft Office, browsing the web, or using operating systems like Windows, macOS, or Linux, keyboard shortcuts allow you to navigate and 8 min read What is an IP Address? Imagine every device on the internet as a house. For you to send a letter to a friend living in one of these houses, you need their home address. In the digital world, this home address is what we call an IP (Internet Protocol) Address. It's a unique string of numbers separated by periods (IPv4) or 14 min read Understanding file sizes | Bytes, KB, MB, GB, TB, PB, EB, ZB, YB In the digital world, data is stored, processed, and transferred using a binary system that revolves around bits and bytes. Understanding how this system works is essential for anyone looking to navigate the world of computers, whether you're a student, a professional, or just someone curious about 11 min read Generations of Computers The modern computer took its shape with the arrival of your time. It was around the 16th century when the evolution of the computer started. The initial computer faced many changes, obviously for the better. It continuously improved itself in terms of speed, accuracy, size, and price to urge the for 8 min read Format Specifiers in C The format specifier in C is used to tell the compiler about the type of data to be printed or scanned in input and output operations. They always start with a % symbol and are used in the formatted string in functions like printf(), scanf, sprintf(), etc.The C language provides a number of format s 5 min read Pattern Programs in C Printing patterns using C programs has always been an interesting problem domain. We can print different patterns like star patterns, pyramid patterns, Floyd's triangle, Pascal's triangle, etc. in C language. These problems require the knowledge of loops and if-else statements.We will discuss the fo 15+ min read Software and its Types In a computer system, the software is basically a set of instructions or commands that tell a computer to do a specific task that serves its users. A software is not a physical thing like hardware, it rather makes the hardware work as per user requirements by giving instructions.Examples of software 6 min read Cloud Deployment Models Cloud Computing has now become an essential part of modern businesses, offering flexibility, scalability, and cost-effective solutions. But Selecting the most appropriate cloud deployment model is essential to utilize the complete potential of cloud services. Whether you're a small business or a lar 12 min read Types of Computers A computer is an electronic device that has storage, computations, input (data), output (data) and networking capabilities. With the growing AI, computers also have learning capabilities from the data provided. The input and output data can be in different forms like text, images, audio and video. A 8 min read Like