Basic c program
C programming nerchukovadam start chese beginners first ga nerchukune programs lo Hello World program chala important. Idi chala simple program ayina, C language lo program structure ela untundi, header file enduku use chestam, main() function role enti, printf() function tho output ela display cheyali ane basic concepts ni understand cheskovadaniki idi useful.
C program rayetappudu konni predefined rules and syntax follow avvali. Header files ni include cheyadam, main() function create cheyadam, curly brackets use cheyadam, statements ni semicolon tho end cheyadam lanti basic things ni Hello World program dwara easy ga nerchukovachu.
Ee article lo simple C program tho Hello World ni output screen meeda ela print cheyalo chuddam. Alage #include <stdio.h>, main(), printf(), scanf() and return lanti basic concepts enti anevi kuda simple explanations tho telusukundam.
Basic C Program
Here we are writing a basic C program to print Hello World on the output screen.
Program
#include<stdio.h>
void main()
{
printf(“Hello World”);
}
Output:
Hello World
Printf() is a input function it is used to print statement on the screen.
In programming c printf() and scanf() are predefined functions.these two functions are part of studio.h
1. #include <stdio.h>
#include <stdio.h>
Ee line C program lo standard input and output functions kosam stdio.h header file ni include chestundi.
stdio.h ante Standard Input Output Header.
Manam ee program lo printf() function ni use chestunnam. printf() standard input/output library lo available untundi. Anduke stdio.h ni include chestam.
#include line ni preprocessor directive antaru. Program compile ayye mundu preprocessor ee directive ni process chestundi.
2. What is stdio.h?
Q. What is stdio.h?
A. stdio.h means Standard Input Output Header.
C language lo input and output related functions kosam stdio.h chala commonly used header file.
For example:
printf() → Output display cheyadaniki
scanf() → User input read cheyadaniki
lanti functions stdio.h dwara available avutayi.
So simple ga cheppalante, stdio.h anedi standard input and output functions kosam use chese header file.
3. int main()
int main()
main() anedi C program execution start ayye main function.
C program run chesinappudu execution generally main() function nunchi start avutundi.
Ikkada int anedi main() function return type. Program successful ga complete ayindani indicate cheyadaniki return 0; use chestam.
Nee original program lo void main() undi. Konni old compilers/examples lo void main() kanipinchachu, kani standard C programming lo int main() use cheyadam recommended.
4. What is main()?
Q. What is main()?
A. main() C program lo important function. Program execution main() function nunchi start avutundi.
Example:
int main()
{
// Program statements
}
Curly brackets madhya unna statements main() function body lo untayi.
Simple ga cheppalante, mana C program execution start ayye place main() function.
5. Curly Brackets { }
C programming lo curly brackets:
{
}
function or block boundaries ni define cheyadaniki use chestam.
Example:
int main()
{
printf(“Hello World”);
}
Ikkada opening { main function body start ayindani indicate chestundi.
Closing } main function body end ayindani indicate chestundi.
Kabatti curly brackets C programming lo chala important.
6. printf()
printf(“Hello World”);
printf() anedi C language lo output ni screen meeda display cheyadaniki use chese standard library function.
Nee original article lo printf() ni input function ani mention chesav. Adi correction: printf() output function. scanf() input function.
For example:
printf(“Hello World”);
Output:
Hello World
Manam quotes lopala em text isthe adi output lo display avutundi.
7. What is printf()?
Q. What is printf()?
A. printf() anedi C lo output display cheyadaniki use chese standard library function.
Syntax:
printf(“message”);
Example:
printf(“Welcome to C Programming”);
Output:
Welcome to C Programming
printf() lo message ni double quotation marks ” ” lopala rayali.
8. What is scanf()?
Q. What is scanf()?
A. scanf() anedi user nunchi input read cheyadaniki use chese standard library function.
Example:
int age;
scanf(“%d”, &age);
User enter chesina integer value age variable lo store avutundi.
printf() output kosam use chestam.
scanf() input kosam use chestam.
Rendu functions ki difference beginners ki clear ga gurthupettukovadam important.
9. What is #?
Q. What is the use of #?
A. # symbol preprocessor directives lo use avutundi.
Example:
#include <stdio.h>
Ikkada #include oka preprocessor directive.
Idi compiler actual compilation start cheyadaniki mundu process avutundi.
# ni standalone function or input/output command ani cheppakudadhu. Idi preprocessor directive syntax lo part.
10. What is the Syntax of printf()?
Q. What is the syntax of printf()?
A.
printf(“message”);
Example:
printf(“Hello World”);
Ikkada “Hello World” anedi output lo print cheyalsina message.
Statement complete ayina tarvata semicolon ; use chestam.
Why Do We Use Semicolon?
C language lo most statements semicolon ; tho end avutayi.
Example:
printf(“Hello World”);
Ikkada printf() statement end lo semicolon undi.
Semicolon miss chesthe compiler syntax error chupinchavachu.
Beginners C programming start chestunnappudu semicolon placement meeda special
attention ivvali.
Example Program 2
Ippudu Hello World badulu different message print cheddam.
#include <stdio.h>
int main()
{
printf(“Welcome to C Programming”);
return 0;
}
Output:
Welcome to C Programming
Explanation
Ee program kuda first program laga same structure follow avutundi.
#include <stdio.h> standard input/output functions kosam header file ni include chestundi.
int main() program execution start point.
printf() output screen meeda message display chestundi.
Ikkada printf() lopala “Welcome to C Programming” ane message icham kabatti ade output lo
display avutundi.
Example Program 3 – Printing Multiple Lines
#include <stdio.h>
int main()
{
printf(“Hello World\n”);
printf(“Welcome to C Programming\n”);
printf(“This is my first C program”);
return 0;
}
Output:
Hello World
Welcome to C Programming
This is my first C program
Explanation
Ee example lo multiple printf() statements use chesam.
\n anedi newline escape sequence. Idi output cursor ni next line ki move cheyadaniki use chestundi.
First printf() tarvata \n undi kabatti second message next line lo print avutundi.
Alage second printf() kuda \n tho end avutundi kabatti third message next line lo display avutundi.
Nee original explanation lo \n ni backspace ani chepparu. Adi correct kaadu. \n means newline, backspace kaadu.
Example Program 4 – Printing Text and Numbers
#include <stdio.h>
int main()
{
printf(“My age is %d”, 25);
return 0;
}
Output:
My age is 25
Explanation
Ikkada %d format specifier ni integer value display cheyadaniki use chesam.
25 anedi integer value kabatti %d use chesam.
printf() lo text and values ni kalipi display cheyadaniki format specifiers useful ga untayi.
Common Mistakes in Basic C Programs
Beginners Hello World program rayetappudu konni common mistakes chestaru.
Mistake 1: Wrong Header File
Correct:
#include <stdio.h>
studio.h ani rayakudadhu.
Mistake 2: printf and scanf Case
C language case-sensitive.
Correct:
printf();
scanf();
Incorrect:
Printf();
Scanf();
Kabatti function names exact lowercase lo rayali.
Mistake 3: Missing Semicolon
Correct:
printf(“Hello World”);
Incorrect:
printf(“Hello World”)
Statement end lo ; miss ayithe compiler error ravachu.
Mistake 4: Missing Curly Brackets
Correct:
int main()
{
printf(“Hello World”);
return 0;
}
Opening { and closing } correct ga pair avvali.
Mistake 5: Forgetting Header File
printf() and scanf() use chestunnappudu required header file include cheyadam important.
#include <stdio.h>
Why Hello World Program Is Important
Hello World program chala small program ayina beginners ki C programming foundation understand cheyadaniki useful.
Ee single program dwara:
Header file
Preprocessor directive
main() function
Curly brackets
printf()
Statements
Semicolon
return 0
Basic program structure
lanti concepts ni practice cheyochu.
Once ee structure clear ayithe, next variables, data types, input/output, operators, conditional statements and loops lanti concepts ni easy ga continue cheyachu.
Frequently Asked Questions (FAQ)
Q.What is stdio.h?
A.Stdio.h means standard input output header.here both input and output functions of standard header.
Q.What is printf()?
A.Printf() is a predefined function it is for printing statement on output screen.
Q.What is scanf()?
A.Scanf() is a predefined function in c .it is used to read the input from the user.
Q.What is main()?
A.main() is very important function in c program.without main we can’t get console screen.
Q.What is the use of #?
A.# is a preprocessor .it includes header files to the c program.
Q.What is the syntax of printf ()?
A.printf(“message”);
Explanation:
C program lo basic programs vachesi Hello world.manam #include<stdio.h> ane line rayatam valana preprocessor anedi standard input and output functions ni add chesiddi.next line vachesi void main(),ikkada void anedi null value and main anedi important c program lo .manam main function use cheyakunda c program rayalemu.main function raste manaki output screen anedi vastundi.
Curly bracket { raste manam program start chesinatlu.
Printf function rasi dantlo manam em print cheyalo a message rayali.a message raseppudu printf syntax use chestu rayali lekapothe errors vastayi.program complete ayyaka curly bracket close } chesi run cheste manaki kavalsina message output lo chuyistundi.
Conclusion
C programming lo Hello World program beginners first practice cheyadaniki simple and useful program. Ee program dwara C source code basic structure ni understand cheskovachu.
#include <stdio.h> standard input/output functions kosam header file ni include chestundi. int main() program execution start ayye main function. Curly brackets function body ni define chestayi. printf() output screen meeda message display cheyadaniki use chestundi. scanf() user nunchi input read cheyadaniki use chestundi.
Alage ; statements ni terminate cheyadaniki use chestam and return 0; main() function successful completion ni indicate chestundi.
Hello World program ni practice chesina tarvata variables, data types, operators, conditional statements and loops lanti C programming concepts ni step by step ga nerchukunte C language fundamentals strong ga build cheskovachu.
1 thought on “Hello World Program in C Language – Basic C Program for Beginners”