This sample program will print Welcome to C programming.
// Sample C program
#include<stdio.h>
#include<conio.h>
int main()
{
clrscr();
printf(“ Welcome to C programming”);
getch();
return 0;
}
Brief explanation of each line of the program is given below:
(1) // Sample C program
This is a comment line. Comments are used to document the program. It is like a remark from the programmer. They can appear in any part of the program. We write comments for better understanding of the program. The comments are ignored by the compiler. Comments are useful for software maintenance.
(2) #include<stdio.h>
This command includes standard input/output header file, stdio.h from the C library in the program before compiling. The stdio.h file contains functions such as scanf() and printf() to take input and display output respectively. #include is preprocessor directive, and stdio.h is Header file. Header files in C have a .h extension.
The #include directive can be used to include pre-existing header files or user-defined header files. the #include directive tells the preprocessor to include the contents of a specified file at the point where the directive appears. This allows the programmer to import header files into their program and access the functions and methods within them.
(3) #include<conio.h>
This command includes console input/output header file, conio.h from the C library in the program. The conio.h file contains functions such as clrscr() and getch() to clear the output screen and pause the output screen.
(4) int main()
Here main() is the function name and int is the return type of this function. It is a compulsory part of every C program. It is a special function used to inform the compiler that the program starts from there. Execution of every C program starts from main() function. Logically every program must have exactly one main() function.
(5) { and }
The opening curly bracket ‘{’ indicates the beginning of the main function and the closing curly bracket ‘}’ indicates the end of the main function.
(6) clrscr();
clrscr() is a library function (system defined function) used to clear the console screen. It is defined in conio.h header file. Using of clrscr() function in C is always optional . If the function is to be used, then it should be placed after variable or function declaration only.
(7) printf(“Welcome to C programming”) ;
This command tells the compiler to display the message “Welcome to C programming”. printf() is a library function used in C to display the output onto the screen. The text to be printed is enclosed in double quotes.
(8) Use of semicolon “;”
The semicolon serves as the statement terminator. Semicolon character at the end of the statement is used to indicate that the statement is ending there. Each executable statement should have a ‘;’ to inform the compiler that the statement has ended. Thus, in ‘C’ the semicolon terminates each statement.
(9) getch();
getch() function pauses the output console screen until a key is pressed. It is defined in conio.h header file. This function is used to hold the output screen for some time until the user presses a key from the keyboard.
(10) return 0;
The return statement is used to return a value from a function and indicates the finishing of a function. The value ‘0’ means successful execution of this function. This statement is basically used in functions to return the results of the operations performed by a function.
As a Newbie, I am continuously browsing online for articles that can be of assistance to me. Thank you
Great – I should definitely pronounce, impressed with your web site. I had no trouble navigating through all the tabs and related info ended up being truly easy to do to access. I recently found what I hoped for before you know it at all. Quite unusual. Is likely to appreciate it for those who add forums or something, web site theme . a tones way for your customer to communicate. Nice task..
Yay google is my queen helped me to find this great internet site! .
This is very interesting, You’re a very skilled blogger. I have joined your rss feed and look forward to seeking more of your great post. Also, I have shared your web site in my social networks!
What¦s Happening i’m new to this, I stumbled upon this I have discovered It positively helpful and it has helped me out loads. I hope to give a contribution & assist different customers like its helped me. Good job.
Thank you for the sensible critique. Me and my neighbor were just preparing to do some research about this. We got a grab a book from our area library but I think I learned more clear from this post. I’m very glad to see such fantastic info being shared freely out there.
Attractive portion of content. I simply stumbled upon your website and in accession capital to say that I get in fact enjoyed account your blog posts. Anyway I’ll be subscribing to your augment or even I achievement you get admission to persistently rapidly.
It’s actually a great and useful piece of information. I am glad that you just shared this helpful info with us. Please keep us up to date like this. Thanks for sharing.
After study a few of the blog posts on your website now, and I truly like your way of blogging. I bookmarked it to my bookmark website list and will be checking back soon. Pls check out my web site as well and let me know what you think.
Real great information can be found on site.
I?¦ve learn several good stuff here. Certainly price bookmarking for revisiting. I surprise how so much effort you set to create any such fantastic informative website.
Wow, incredible blog layout! How long have you been blogging for? you made blogging look easy. The overall look of your website is fantastic, as well as the content!
You are my breathing in, I possess few web logs and occasionally run out from to post : (.
You got a very excellent website, Sword lily I noticed it through yahoo.
I’d forever want to be update on new articles on this website , saved to my bookmarks! .
There is noticeably a bundle to know about this. I assume you made certain nice points in features also.
Appreciate it for helping out, excellent info. “Our individual lives cannot, generally, be works of art unless the social order is also.” by Charles Horton Cooley.
Some genuinely interesting details you have written.Aided me a lot, just what I was looking for : D.
Enjoyed looking at this, very good stuff, thankyou.
magnificent put up, very informative. I wonder why the opposite experts of this sector do not understand this. You should continue your writing. I’m sure, you have a huge readers’ base already!
I am so happy to read this. This is the type of manual that needs to be given and not the accidental misinformation that is at the other blogs. Appreciate your sharing this best doc.
Hello my loved one! I wish to say that this article is amazing, nice written and include almost all significant infos. I¦d like to see more posts like this .
There is apparently a lot to realize about this. I consider you made some good points in features also.
I have read a few good stuff here. Certainly price bookmarking for revisiting. I surprise how a lot effort you place to make any such great informative web site.
This web site is really a walk-through for all of the info you wanted about this and didn’t know who to ask. Glimpse here, and you’ll definitely discover it.
Very interesting subject, appreciate it for posting.
Very well written information. It will be helpful to anybody who employess it, as well as me. Keep up the good work – for sure i will check out more posts.
Sweet internet site, super style and design, rattling clean and utilize pleasant.
Very interesting info!Perfect just what I was searching for!
I have not checked in here for some time since I thought it was getting boring, but the last few posts are great quality so I guess I?¦ll add you back to my daily bloglist. You deserve it my friend 🙂
I couldn’t resist commenting
Hey very nice website!! Man .. Excellent .. Amazing .. I’ll bookmark your site and take the feeds also…I am happy to find so many useful info here in the post, we need work out more strategies in this regard, thanks for sharing. . . . . .
Loving the info on this internet site, you have done great job on the articles.
Its like you read my mind! You seem to know so much about this, like you wrote the book in it or something. I think that you could do with a few pics to drive the message home a little bit, but other than that, this is great blog. An excellent read. I’ll definitely be back.
Hello very cool web site!! Guy .. Beautiful .. Wonderful .. I will bookmark your site and take the feeds additionallyKI am satisfied to search out numerous helpful info right here within the publish, we need work out extra strategies on this regard, thank you for sharing. . . . . .
Great wordpress blog here.. It’s hard to find quality writing like yours these days. I really appreciate people like you! take care
Thank you for another excellent article. Where else could anybody get that type of info in such a perfect way of writing? I’ve a presentation next week, and I’m on the look for such info.
I don’t ordinarily comment but I gotta tell appreciate it for the post on this amazing one : D.
I really happy to find this web site on bing, just what I was searching for : D as well bookmarked.
Saved as a favorite, I really like your blog!
I am glad to be one of several visitants on this outstanding site (:, thanks for posting.
We are a bunch of volunteers and starting a new scheme in our community. Your site provided us with valuable info to work on. You’ve done an impressive activity and our entire group shall be grateful to you.
Saved as a favorite, I really like your blog!
I¦ve read a few good stuff here. Definitely worth bookmarking for revisiting. I surprise how so much attempt you place to create this type of great informative site.
Some really interesting points you have written.Aided me a lot, just what I was looking for : D.
Very interesting details you have noted, regards for posting.
I’ve learn some excellent stuff here. Definitely worth bookmarking for revisiting. I wonder how much effort you set to create the sort of fantastic informative web site.
I don’t unremarkably comment but I gotta admit regards for the post on this great one : D.
Needed to post you this very small observation to help say thanks yet again for these awesome views you’ve documented in this case. It is so incredibly generous of people like you to provide unhampered all many people might have offered for an ebook to end up making some bucks on their own, precisely considering the fact that you might have done it if you desired. These inspiring ideas likewise served as the fantastic way to recognize that most people have similar fervor like my own to learn many more related to this problem. I think there are millions of more fun sessions up front for many who discover your blog.
I like this post, enjoyed this one thanks for putting up.
I have been browsing on-line greater than three hours lately, but I by no means discovered any fascinating article like yours. It is beautiful worth sufficient for me. Personally, if all web owners and bloggers made good content as you did, the net will probably be a lot more useful than ever before.
whoah this weblog is wonderful i like reading your posts. Keep up the good work! You already know, many persons are hunting round for this information, you could help them greatly.
This actually answered my downside, thanks!
Hola! I’ve been following your blog for a while now and finally got the bravery to go ahead and give you a shout out from Atascocita Texas! Just wanted to tell you keep up the great job!
Im no longer sure where you’re getting your information, but good topic. I needs to spend a while studying much more or understanding more. Thanks for magnificent info I was on the lookout for this info for my mission.
I have been browsing on-line greater than 3 hours today, but I never discovered any interesting article like yours. It¦s lovely value enough for me. Personally, if all webmasters and bloggers made excellent content as you probably did, the net shall be much more helpful than ever before.
Utterly indited written content, Really enjoyed reading through.
Hi my loved one! I wish to say that this post is amazing, great written and come with almost all vital infos. I’d like to peer extra posts like this .
As a Newbie, I am permanently searching online for articles that can benefit me. Thank you
Its superb as your other posts : D, appreciate it for putting up. “Slump I ain’t in no slump… I just ain’t hitting.” by Yogi Berra.
After examine a couple of of the weblog posts on your web site now, and I truly like your manner of blogging. I bookmarked it to my bookmark website checklist and will probably be checking again soon. Pls check out my website as nicely and let me know what you think.
Hi , I do believe this is an excellent blog. I stumbled upon it on Yahoo , i will come back once again. Money and freedom is the best way to change, may you be rich and help other people.
Hi there, You have done a great job. I will certainly digg it and for my part recommend to my friends. I am confident they’ll be benefited from this site.
You got a very excellent website, Sword lily I found it through yahoo.
Very interesting points you have remarked, regards for putting up.
Hello! This is my first visit to your blog! We are a group of volunteers and starting a new project in a community in the same niche. Your blog provided us useful information to work on. You have done a extraordinary job!
Thanks for sharing superb informations. Your website is very cool. I’m impressed by the details that you have on this website. It reveals how nicely you understand this subject. Bookmarked this web page, will come back for extra articles. You, my friend, ROCK! I found just the information I already searched all over the place and simply could not come across. What an ideal site.
Hi my friend! I want to say that this article is awesome, nice written and include approximately all significant infos. I would like to see more posts like this.
Your style is so unique compared to many other people. Thank you for publishing when you have the opportunity,Guess I will just make this bookmarked.2
This really answered my problem, thank you!