How to make a program by using c?

A C program basically consists of the following parts−

• Preprocessor Commands
• Functions
• Variables
• Statements & Expressions
• Comments

Now I am going to tell you how you can print your name by using c programming. The simple code that will print your name in the screen is given below:

#include <stdio.h>
int main() {
/* my first program in C */
printf(“Hello, World! \n”);

return 0;
}

In the all program standard input output (I.e. stdio) is included. Int is a data type called integer. All the statement should be written inside curly bracket and they must be closed by semicolon. The comment must be written in this format /*…………*/. Comment is not compiled by compiler it helps coder to easily understand the code. Printf is a function available on c which is used to print the message in the screen. Return 0; terminates the main() function and returns the value 0.

Data types in c
There are two data types in c. They are fundamental types and derived types. The fundamental types includes following data.

1. int – Integer
Integers are whole numbers that can have both positive and negative values but no decimal values. Example: 0, -5, 10.

2. float – Floating
Floating type variables can hold real numbers such as: 2.34, -9.382, 5.0 etc. You can declare a floating point variable in C by using either float or double keyword. For example:

float accountBalance;
double bookPrice; etc .

3. Keyword char is used for declaring character type variables. For example:

char test = ‘h’.

Similarly derived types includes following data types includes following
(a) Pointer types
(b) Array types
(c) Structure types
(d) Union types and
(e) Function types, will be discussing more on coming articles.

Feedback

Did you like our works?

Send us your requirements to get a quote.

2019 Tech101 PVT LTD. All Rights Reserved.