Article /
Computers /
Software
C Programming | Tutorial for Beginners |
|
By
Deeksha
https://www.webindia123.com/user_interaction/asp/view_profile.asp?login_id=15710
21.7.2017
Image
Phone:9918697448
Mail Now
Send Mail
Post Comments
|
|
A simple C program to display "Hello, World!" on the
screen. Since, it's a very simple program, it is often used to illustrate the
syntax of a programming language.
Program to Display "Hello, World!"
#include
int main()
{
// printf() displays the string inside quotation
printf("Hello, World!");
return 0;
}
How "Hello, World!" program works?
- The #include is a preprocessor command. This command tells
compiler to include the contents of stdio.h (standard input and output) file
in the program.
The stdio.h file contains functions such as scanf() and print() to take
input and display output respectively.
If you use printf() function without writing #include , the program
will not be compiled.
- The execution of a C program starts from the main() function.
- The printf() is a library function to send formatted output to the
screen. In this program, the printf() displays Hello, World! text on the
screen.
- The return 0; statement is the "Exit status" of the program. In simple
terms, program ends with this statement.
Data Types Associated With Variables
In this section we are only going to discuss about the
local variables. These are the variables that are used within the current
program unit (or function). In later section we will have a look on global
variables which are available for all program’s functions.
There are five basic data types associated with
variables:-
1. int – integer: a whole number
2. float – floating point value: i.e., a number with a fractional part.
3. double – a double- precision floating point value.
4. char – a single character.
5. void - valueless special purpose type which we will examine in later
sections.
If you want to learn C programming, join C language course at ETL Labs, Gomti
Nagar, Lucknow.
TAGS:
c programming language,
c tutorial,
c programming,
c program examples,
programming tutorial for beginners,
,
what is c language,
DISCLAIMER: The views and opinions expressed in this article are those of the authors /contributors and do not necessarily reflect the official policy/opinion of webindia123.com / Suni systems Pvt. Ltd. Webindia123.com / Suni systems Pvt. Ltd and its staff, affiliates accept no liability whatsoever for any loss or damage of any kind arising out of the use of all or any part of the material published in the site. In case of any queries,or complaints about the authenticity of the articles posted by contributors, please contact us via email.