0% found this document useful (0 votes)
18 views

Himanshu PTLN

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views

Himanshu PTLN

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 31

Submitted in partial fulfilment of the award of the degree of

Bachelor of technology (B.Tech)


In

Electronics and communication engineering

Submitted by:
HIMANSHU
PATLAN

8721213
2021-2025

Submitted To: Mr. Shiv Goel

Department of, Electronics and Communication Engineering


State Institute of Engineering and Technology, Nilokheri (Karnal)
(Affiliated to Kurukshetra University, Kurukshetra)
DECLARATION BY THE CANDIDATE

I hereby declare that the training report entitled "C language" submitted by me to State
Institute of Engineering & Technology, Nilokheri (Karnal) in partial fulfilment of the
requirement for the award of the degree of B.TECH in ECE is a record of bonafide training
work carried out by me. I further declare that the work reported in this project has not been
submitted and will not be submitted, either in part or in full, for the award of any other degree
or diploma in this institute or any other institute or university.

Signature of the Candidate


Date: Name: Himanshu patlan
Place: ECE 5th sem
Roll no.: 8721213

CERTIFICATE

This is to certify that the above statement made by the candidate is correct to the best
of my knowledge.

Officer In-charge
Electronics and Communication Engineering State Institute of Engineering &
Technology, Nilokheri (Karnal)
ABSTRACT
C is a procedural programming language. It was initially developed by Dennis Ritchie in
the year 1972. It was mainly developed as a system programming language to write an
operating system. The main features of the C language include low-level memory access,
a simple set of keywords, and a clean style, these features make C language suitable for
system programing like an operating system or compiler development.

Many later languages have borrowed syntax/features directly or indirectly from the C
language. Like syntax of Java, PHP, JavaScript, and many other languages are mainly
based on the C language. C++ is nearly a superset of C language (Few programs may
compile in C, but not in C++).

C is a general-purpose programming language that is extremely popular, simple, and


flexible to use. It is a structured programming language that is machine-independent and
extensively used to write various applications, Operating Systems like Windows, and
many other complex programs like Oracle, database, git , and many more.
ACKNOWLEDGEMENT
I thank the almighty for giving us the courage and perseverance in completing the main project .This project itself
is acknowledgements for all those people who have give us their heartfelt co-operation in making this project a
grand success.

To complete a project the person associated with it must have dedication, patience, focus, planning and skill of
course. With the absence of these attributes either the project never results desired outcome or not completed as
expected. As all, I would like to thank all those who supported fully to make the desired project a running one.
During the course many people supported as a motivator and as a mentor.

I am highly indebted to Internet & Trainer for knowledge which makes me skill for the project. Programming
with C by ANSI C is most useful book and Udemy, C tutorial, Geeks For Geeks are the most supporting
online platform for providing necessary information like what datasets can be used, different methods to solve
errors in coding& also as a support in completing the project.

I would like to express my special gratitude and thanks to my project guide Mr.Shiv Goel for giving me such
attention and time in the institute itself and for providing valuable guidance in every stage for this project work.
And also for providing me different ideas which helps me in project.

Last but not least, we would like to express our deep sense of gratitude and earnest thanks giving to our dear
parents for their moral support and heartfelt cooperation in doing the main project.

NAME- HIMANSHU PATLAN

ROLL NO- 8721213

ECE 5TH SEM.


COMPANY PROFILE

Spoken Tutorial is a multi-award winning educational content portal. Here one can learn
various Free and Open Source Software all by oneself. Our self-paced, multi-lingual
courses ensure that anybody with a computer and a desire for learning, can learn from
any place, at any time and in a language of their choice. All the content published on this
website are shared under the CC BY SA license.

Our courses are simple and easy to follow even for a beginner but they also meet the
growing needs of the learner. Our engaging digital content ensures that learning happens
at all levels - Basic, Intermediate and Advanced. Our content mandates side-by-side
practice thereby ensuring that learners are actively learning. Many of the software
taught, are used in various disciplines of Engineering, pure Sciences and several other
Under-Grad and Post-Grad studies, and can be extended to Commerce, Arts and
Management streams as well. Alongside these, there are some courses relevant at School
level, too, which help school students to visualise difficult concepts of Math and Science.
These can also be used by Teachers to prepare lesson plans, explain abstract concepts and
give digital assignments to students.

The learning can happen in an organised manner as well. Faculty in institutes can
organise their batch of students into groups, who will learn a particular software course
for an entire semester. The ST course can be mapped to the Course/Lab manuals and
systematic learning can take place. If the academic timetable permits, then a single
student can learn upto 3 different ST courses in one semester during the designated
academic Lab hours.

End-of-Course online tests and certificates are available for those who wish to test their
expertise in a particular software. These certificates give an edge to students during
placement by increasing their employability potential. For more details, please write to
contact [at] spoken-tutorial [dot] org.
LIST OF FIGURES

Fig. No. Caption Page No.

Figure.1.1 Layout Of C 15
Program
TABLE OF CONTENTS

Title Page No.


Declaration 3
Abstract 4
Acknowledgement 5
Company profile 6
List of figures 7
Chapter 1 : Introduction 10
1.1 What is ‘c ’? 10
1.2 Where is ‘c’ being used? 11
1.3 Types of c application 12
1.4 Features Of c 12
1.5 Java editors 13
Chapter 2 : C Environment 13
2.1 Basic Program 14
2.1.1 Types Of Languages 14
2.1.2 C Translator 15
2.1.3 Integrated Development Environment(IDE) 15
2.2 Structure Of C Program 15
2.2.1 Preprocessor Directive 16
2.2.2 Global Declaration 16
2.2.3 Main 17
Chapter 3 : Declaration & Assignments 18
3.1 C Identifiers 18
3.2 C Keywords 18
3.3 C Operators 19
3.4 C Decision Making 19
3.5 C Loops 20
3.6 C Function 20
3.7 C Array 21
3.8 C Pointer 22
3.9 C String 23
3.10 C Structure 24
3.11 C Union 25
3.12 C File Handling 25
Chapter 4 : Data Types 26
4.1 Data Types in C 26
4.2 Integers Types 27
4.3 Floating Point Types 29
4.4 the Void Type 29
4.5 C Variables 30
Chapter 5 : Conclusion 31
References 31
CHAPTER-1
Introduction

C is a programming language developed at AT & T’s Bell Laboratories of USA in 1972.


It was designed and written by a man named Dennis Ritchie. In the late seventies C
began to replace the more familiar languages of that time like PL/I, ALGOL, etc ANSI C
standard emerged in the early 1980s, this book was split into two titles:

The original was still called Programming in C, and the title that covered ANSI C was
called Programming in ANSI C. This was done because it took several years for the
compiler vendors to release their ANSI C compilers and for them to become ubiquitous.
It was initially designed for programming UNIX operating system.

Now the software tool as well as the C compiler is written in C. Major parts of popular
operating systems like Windows, UNIX, Linux is still written in C. This is because even
today when it comes to performance (speed of execution) nothing beats C. Moreover, if
one is to extend the operating system to work with new devices one needs to write device
driver programs. These programs are exclusively written in C. C seems so popular is
because it is reliable, simple and easy to use. often heard today is – “C has been already
superceded by languages like C++, C# and Java.

What is ‘C’?
a) C is a high level structured oriented programming language ,used in
general purpose programming.
b) C works with in built compiler ,convert program to machine coded
language.
c) C is most preferred language for decades now , due to its high
performance , remarkable efficiency and its portability.
d) C is a successor of “ basic combined programming language” (bcpl) called
b language.
1.1 Where is ‘C’ being used?

❖ C is a middle-level programming language developed by Dennis Ritchie during the


early 1970s while working at AT&T Bell Labs in the USA.
❖ The objective of its development was in the context of the re-design of the UNIX
operating system to enable it to be used on multiple computers.

❖ Earlier the language B was now used for improving the UNIX system. Being a
high-level language, B allowed much faster production of code than in assembly
language.
❖ Still, B suffered from drawbacks as it did not understand data-types and did not
provide the use of “structures”.

❖ These drawbacks became the driving force for Ritchie for development of a new
programming language called C. He kept most of language B’s syntax and added
data-types and many other required changes.
❖ Eventually, C was developed during 1971-73, containing both high-level
functionality and the detailed features required to program an operating system.
Hence, many of the UNIX components including UNIX kernel itself were
eventually rewritten in C.

1.2 Types of C Application

Use of the C programming language is not limited to the development of operating


systems and applications. It is also used in GUI development, IDE development, etc.
Some uses of C programming language:-
1. Operating Systems
2. Assemblers
3. Text Editors
4. Print Spoolers
5. Modern Programs
6. Databases
7. Utilities

Hold Tight, because I am going to tell you some exciting real-world applications of C.

1. Operating Systems:-
What is better than writing your own operating system? And yes, with the help of the C
programming language, you can write your own operating system. Windows Kernel,
Linux Kernel and Apple’s OS X kernel are mostly written in C.
2. GUI:-
It stands for Graphical User Interface. The C programming language also helps in
developing popular adobe softwares like Photoshop, Premier Pro, Illustrator etc.
3. Embedded Systems:-
In daily life, we use different embedded systems like coffee machines, microwaves,
climate control systems etc. These all are mostly programmed in C.
4. Database:-
The C programming language helps in developing the popular database management
system, MySQL.
5. Ease of Computation:-
C provides faster computation in programs. The implementation of algorithms and data
structures is swift in C. With the help of C, you can perform high degree calculations
such as MATLAB, Mathematica etc.
6. Gaming:-
C programming is relatively faster than Java or Python. It has been used in various
gaming applications and graphics. C programming language also helps in creating many
popular childhood games like Tic-Tac-Toe, The Snake game etc.

And much more……………..


1.3 Features of C Language:-

❖ As a middle-level language, C combines the features of both high-level


and low-level languages. It can be used for low-level programming, such
as scripting for drivers and kernels and it also supports functions of high-
level programming languages, such as scripting for software applications
etc.
❖ C is a structured programming language which allows a complex program
to be broken into simpler programs called functions. It also allows free
movement of data across these functions.
❖ Various features of C including direct access to machine level hardware
APIs, the presence of C compilers, deterministic resource use and
dynamic memory allocation make C language an optimum choice for
scripting applications and drivers of embedded systems.
❖ C language is case-sensitive which means lowercase and uppercase
letters are treated differently.
❖ C is highly portable and is used for scripting system applications which
form a major part of Windows, UNIX, and Linux operating system.
❖ C is a general-purpose programming language and can efficiently work on
enterprise applications, games, graphics, and applications requiring
calculations, etc.
❖ C language has a rich library which provides a number of built-in
functions. It also offers dynamic memory allocation.

1.4 C Editors
There is even more sophisticated IDE available in the market. But for now, you can
consider one of the following:

● Notepad - On Windows machine, you can use any simple text editor like Notepad
(Recommended for this tutorial), TextPad.
● Netbeans - is a C IDE that is open source and free which can be downloaded
from http://www.netbeans.org/index.html
● Eclipse - is also a C IDE developed by the Eclipse open source community and
can be downloaded from http://www.eclipse.org/
CHAPTER-2

C Environment

2.1 Basic Program


There is a close analogy between learning English language and learning C language. The
classical method of learning English is to first learn the alphabets used in the language,
then learn to combine these alphabets to form words, which in turn are combined to form
sentences and sentences are combined to form paragraphs. Learning C is similar and
easier. Instead of straight-away learning how to write programs, we must first know what
alphabets, numbers and special symbols are used in C, then how using them constants,
variables and keywords are constructed, and finally how are these combined to form an
instruction. A group of instructions would be combined later on to form a program.

2.1.1 Types Of C Languages?

● Low level language:


Low level languages are machine level and assembly level language. In machine level
language computer only understand digital numbers i.e. in the form of 0 and 1. So,
instruction given to the computer is in the form binary digit, which is difficult to
implement instruction in binary code. This type of program is not portable, difficult to
maintain and also error prone. The assembly language is on other hand modified version
of machine level language. Where instructions are given in English like word as ADD,
SUM, MOV etc. It is easy to write and understand but not understand by the machine.

● High level language:


These languages are machine independent, means it is portable. The language in this
category is Pascal, Cobol, Fortran etc. High level languages are understood by the
machine. So it need to translate by the translator into machine level. A translator is
software which is used to translate high level language as well as low level language in
to machine level language.

2.1.2 C Translator
Three types of translator are there:
● Compiler
● Interpreter
● Assembler
Compiler and interpreter are used to convert the high level language into machine level
language. The program written in high level language is known as source program and
the corresponding machine level language program is called as object program. Both
compiler and interpreter perform the same task but there working is different. Compiler
read the program at-a-time and searches the error and lists them. If the program is error
free then it is converted into object program. When program size is large then compiler is
preferred. Whereas interpreter read only one line of the source code and convert it to
object code. If it check error, statement by statement and hence of take more time.

Compilers, interpreters, translate programs written in high-level languages into machine


code that a computer understands. And assemblers translate programs written in low-
level or assembly language into machine code. In the compilation process, there are
several stages. To help programmers write error-free code, tools are available.

Assembly language is machine-dependent, yet mnemonics used to represent instructions


in it are not directly understandable by machine and high-Level language is machine-
independent. A computer understands instructions in machine code, i.e. in the form of 0s
and 1s. It is a tedious task to write a computer program directly in machine code. The
programs are written mostly in high-level languages like Java, C++, Python etc. and are
called source code. These source code cannot be executed directly by the computer and
must be converted into machine language to be executed. Hence, a special translator
system software is used to translate the program written in a high-level language into
machine code is called Language Processor and the program after translated into machine
code (object program/object code).

A compiler is a software that converts programs written in a high level language into
machine language. An interpreter is a software that translates a high level language
program into machine language while an assembler is a software that converts programs
written in assembly language into machine language
2.1.3 Integrated Development Environment(IDE)

The process of editing, compiling, running, and debugging programs is often managed by
a single integrated application known as an Integrated Development Environment, or IDE
for short. An IDE is a windows-based program that allows us to easily manage large
software programs, edit files in windows, and compile, link, run, and debug programs.
On Mac OS X, CodeWarrior and Xcode are two IDEs that are used by many
programmers. Under Windows, Microsoft Visual Studio is a good example of a popular
IDE. Kylix is a popular IDE for developing applications under Linux. Most IDEs also
support program development in several different programming languages in addition to
C, such as C# and C++.

2.2 Structure Of C Program


2.21 Preprocessor Directive

#include tells the compiler to include information about the standard input/output
library. It is also used in symbolic constant such as #define PI 3.14(value). The stdio.h
(standard input output header file) contains definition &declaration of system defined
function such as printf( ), scanf( ), pow( ) etc. Generally printf() function used to display
and scanf() function used to read value.

2.2.2 Global Declaration


A scope in any programming is a region of the program where a defined variable can
have its existence and beyond that variable it cannot be accessed.
There are three places where variables can be declared in C programming language –

• Inside a function or a block which is called local variables.


• Outside of all functions which is called global variables.
• In the definition of function parameters which are called formal parameters.

Let us understand what are local and global variables, and formal parameters
The C compiler recognizes a variable as global, as opposed to local, because its
declaration is located outside the scope of any of the functions making up the program.
Of course, a global variable can only be used in an executable statement after it has
been declared. Hence, the natural place to put global variable declaration statements is
before any function definitions: i.e., right at the beginning of the program. Global
variables declarations can be used to initialize such variables, in the regular manner.
However, the initial values must be expressed as constants, rather than expressions.
Furthermore, the initial values are only assigned once, at the beginning of the program.
2.2.3 Main()

It is the user defined function and every function has one main() function from where
actually program is started and it is encloses within the pair of curly braces. The main( )
function can be anywhere in the program but in general practice it is placed in the first
position. In detail, the JRE consists of various components; these are listed below:

void main(void ) or void main()


{
printf (“C language”);
}
Output: C language.

First c program with return statement:-

#include<stdio.h>
int main (void)
{
printf ("welcome to c Programming language.\n");
return 0;
}
Output: welcome to c programming language.
CHAPTER-3

DECLARATION & ASSIGNMENTS

3.1 C Identifiers

Identifiers are user defined word used to name of entities like variables, arrays, functions,
structures etc. Rules for naming identifiers are:

1. name should only consists of alphabets (both upper and lower case), digits and
underscore (_) sign.
2. first characters should be alphabet or underscore.
3. name should not be a keyword.
4. since C is a case sensitive, the upper case and lower case considered differently, for
example code, Code, CODE etc. are different identifiers.
5. identifiers are generally given in some meaningful name such as value, net_salary,
age, data etc.

An identifier name may be long, some implementation recognizes only first eight
characters, most recognize 31 characters. ANSI standard compiler recognize 31
characters. Some invalid identifiers are 5cb, int, res#, avg no etc.

3.2 C Keywords

There are certain words reserved for doing specific task, these words are known as
reserved word or keywords. These words are predefined and always written in lower case
or small letter. These keywords cann’t be used as a variable name as it assigned with
fixed meaning. Some examples are int, short, signed, unsigned, default, volatile, float,
long, double, break, continue, typedef, static, do, for, union, return, while, do, extern,
register, enum, case, goto, struct, char, auto, const etc.

3.3 C Operators
An operator is a symbol that tells the compiler to perform specific mathematical or logical
functions. C language is rich in built-in operators and provides the following types of
operators −

● Arithmetic Operators
● Relational Operators
● Logical Operators
● Bitwise Operators
● Assignment Operators
● Misc Operators
We will, in this chapter, look into the way each operator works.

3.4 C Decision Making

Decision making structures require that the programmer specifies one or more conditions
to be evaluated or tested by the program, along with a statement or statements to be
executed if the condition is determined to be true, and optionally, other statements to be
executed if the condition is determined to be false.
Show below is the general form of a typical decision making structure found in most of
the programming languages −

C programming language assumes any non-zero and non-null values as true, and if it is
either zero or null, then it is assumed as false value.
3.5 C Loops

Programming languages provide various control structures that allow for more
complicated execution paths.
A loop statement allows us to execute a statement or group of statements multiple times.

1 while loop :

Repeats a statement or group of statements while a given condition is true. It tests the
condition before executing the loop body.

2 for loop :
Executes a sequence of statements multiple times and abbreviates the code that
manages the loop variable.

3 do...while loop :
It is more like a while statement, except that it tests the condition at the end of the loop
body.

4 nested loops :
You can use one or more loops inside any other while, for, or do..while loop.

3.6 C Functions

A function is a group of statements that together perform a task. Every C program has at
least one function, which is main(), and all the most trivial programs can define
additional functions.
A function definition in C programming consists of a function header and a function
body. Here are all the parts of a function −

1. Return Type − A function may return a value. The return_type is the data type of
the value the function returns. Some functions perform the desired operations
without returning a value. In this case, the return_type is the keyword void.
2. Function Name − This is the actual name of the function. The function name and
the parameter list together constitute the function signature.
3. Parameters − A parameter is like a placeholder. When a function is invoked, you
pass a value to the parameter. This value is referred to as actual parameter or
argument. The parameter list refers to the type, order, and number of the
parameters of a function. Parameters are optional; that is, a function may contain
no parameters.
4. Function Body − The function body contains a collection of statements that define
what the function does.

3.7 Array

Arrays a kind of data structure that can store a fixed-size sequential collection of
elements of the same type . An array is used to store a collection of data, but it is often
more useful to think of an array as a collection of variables of the same type.

Instead of declaring individual variables, such as number0, number1, ..., and number99,
you declare one array variable such as numbers and use numbers[0], numbers[1], and ...,
numbers[99] to represent individual variables. A specific element in an array is accessed
by an index.

All arrays consist of contiguous memory locations. The lowest address corresponds to the
first element and the highest address to the last element.

1 Multi-dimensional arrays

C supports multidimensional arrays. The simplest form of the multidimensional array is the two-
dimensional array.

2 Passing arrays to functions


You can pass to the function a pointer to an array by specifying the array's name without an index.

3 Return array from a function


C allows a function to return an array.

4 Pointer to an array
You can generate a pointer to the first element of an array by simply specifying the array name,
without any index.

3.8 C Pointers

Pointers in C are easy and fun to learn. Some C programming tasks are performed more
easily with pointers, and other tasks, such as dynamic memory allocation, cannot be
performed without using pointers. So it becomes necessary to learn pointers to become a
perfect C programmer. Let's start learning them in simple and easy steps.

As you know, every variable is a memory location and every memory location has its
address defined which can be accessed using ampersand (&) operator, which denotes an
address in memory.

1 Pointer arithmetic

There are four arithmetic operators that can be used in pointers: ++, --, +, -

2 Array of pointers
You can define arrays to hold a number of pointers.

3 Pointer to pointer
C allows you to have pointer on a pointer and so on.

4 Passing pointers to functions in C


Passing an argument by reference or by address enable the passed argument to be changed in the
calling function by the called function.

5 Return pointer from functions in C


C allows a function to return a pointer to the local variable, static variable, and dynamically
allocated memory as well.

3.9 C String

Strings are actually one-dimensional array of characters terminated by a null character


'\0'. Thus a null-terminated string contains the characters that comprise the string
followed by a null.

● Types of string Functions :

▪ Strlen()
▪ Strcpy()
▪ Strcat()
▪ Strcmp()
▪ Strrev()
▪ Strchr()

3.10 C Structure

Arrays allow to define type of variables that can hold several data items of the same kind.
Similarly structure is another user defined data type available in C that allows to
combine data items of different kinds.

Structures are used to represent a record. Suppose you want to keep track of your books
in a library. You might want to track the following attributes about each book –

struct [structure tag] {

member definition;
member definition;
...
member definition;
}

3.11 C Union

A union is a special data type available in C that allows to store different data types in
the same memory location. You can define a union with many members, but only one
member can contain a value at any given time. Unions provide an efficient way of using
the same memory location for multiple-purpose.

To define a union, you must use the union statement in the same way as you did while
defining a structure. The union statement defines a new data type with more than one
member for your program.

Union [union tag] {

member definition;
member definition;
...
member definition;
}

The union tag is optional and each member definition is a normal variable definition,
such as int i; or float f; or any other valid variable definition. At the end of the union's
definition, before the final semicolon, you can specify one or more union variables but it
is optional.

3.12 C File Handleing

A file represents a sequence of bytes, regardless of it being a text file or a binary file. C
programming language provides access on high level functions as well as low level (OS
level) calls to handle file on your storage devices.
Filename is a string literal, which you will use to name your file, and access mode can
have one of the following values –

Sr.No. Mode & Description

1
R
Opens an existing text file for reading purpose.

2
W
Opens a text file for writing. If it does not exist, then a new file is created. Here your
program will start writing content from the beginning of the file.

3
A
Opens a text file for writing in appending mode. If it does not exist, then a new file is
created. Here your program will start appending content in the existing file content.

4
r+
Opens a text file for both reading and writing.

5
w+
Opens a text file for both reading and writing. It first truncates the file to zero length if it
exists, otherwise creates a file if it does not exist.

6
a+
Opens a text file for both reading and writing. It creates the file if it does not exist. The
reading will start from the beginning but writing can only be appended.
CHAPTER-4
DATA TYPES
Data types in c refer to an extensive system used for declaring variables or functions of
different types. The type of a variable determines how much space it occupies in storage
and how the bit pattern stored is interpreted.
4.1 Data Types In C

Data Types available in C are:

1 Basic Types
They are arithmetic types and are further classified into: (a) integer types
and (b) floating-point types.

2 Enumerated types
They are again arithmetic types and they are used to define variables that
can only assign certain discrete integer values throughout the program.

3 The type void


The type specifier void indicates that no value is available.

4 Derived types
They include (a) Pointer types, (b) Array types, (c) Structure types, (d)
Union types and (e) Function types.

4.2 Integer Types


The following table provides the details of standard integer types with their storage sizes
and value ranges −
Type Storage size Value range

char 1 byte -128 to 127 or 0 to 255

unsigned char 1 byte 0 to 255

signed char 1 byte -128 to 127

-32,768 to 32,767 or -2,147,483,648 to


int 2 or 4 bytes
2,147,483,647

unsigned int 2 or 4 bytes 0 to 65,535 or 0 to 4,294,967,295

short 2 bytes -32,768 to 32,767

unsigned short 2 bytes 0 to 65,535

long 8 bytes or (4bytes for 32 bit OS) -9223372036854775808 to


9223372036854775807

unsigned long 8 bytes 0 to 18446744073709551615

4.3 Floating Point Types

The following table provide the details of standard floating-point types with storage sizes
and value ranges and their precision –

Type Storage size Value range Precision


float 4 byte 1.2E-38 to 3.4E+38 6 decimal places

double 8 byte 2.3E-308 to 1.7E+308 15 decimal places

long double 10 byte 3.4E-4932 to 1.1E+4932 19 decimal places

4.4 The Void Type

The void type specifies that no value is available. It is used in three kinds of situations –

Sr.No. Types & Description

1 Function returns as void


There are various functions in C which do not return any value or you can say they return
void. A function with no return value has the return type as void. For example, void exit
(int status);

2 Function arguments as void


There are various functions in C which do not accept any parameter. A function with no
parameter can accept a void. For example, int rand(void);

3 Pointers to void
A pointer of type void * represents the address of an object, but not its type. For example,
a memory allocation function void *malloc( size_t size ); returns a pointer to void which
can be casted to any data type.

4.5 C Variables

A variable is nothing but a name given to a storage area that our programs can
manipulate. Each variable in C has a specific type, which determines the size and layout
of the variable's memory; the range of values that can be stored within that memory; and
the set of operations that can be applied to the variable.
1 char
Typically a single octet(one byte). It is an integer type.

2 int
The most natural size of integer for the machine.

3 float
A single-precision floating point value.

4 double
A double-precision floating point value.

5 void
Represents the absence of type.

A variable declaration provides assurance to the compiler that there exists a variable with
the given type and name so that the compiler can proceed for further compilation without
requiring the complete detail about the variable. A variable definition has its meaning at
the time of compilation only, the compiler needs actual variable definition at the time of
linking the program.
A variable declaration is useful when you are using multiple files and you define your
variable in one of the files which will be available at the time of linking of the program.
You will use the keyword extern to declare a variable at any place. Though you can
declare a variable multiple times in your C program, it can be defined only once in a file,
a function, or a block of code.

A variable definition tells the compiler where and how much storage to create for the
variable.

CHAPTER-5
CONCLUSION

We are at the end of this book. You have probably read everything and also tested
some pieces of code with your own hardware, and I'm sure you are now able to
imagine your future and advanced projects with Arduino.

I wanted to thank you for being so focused and interested. I know you are now
almost in the same boat as myself, you want to learn more, test more, and check
and use new technologies in order to achieve your craziest project. I'd like to say
one last thing: do it, and do it now!

In most cases, people are afraid of the huge amount of work that they can imagine
in the first steps just before they start. But you have to trust me, don't think too
much about details or about optimization. Try to make something simple,
something that works. Then you'll have ways to optimize and improve it.

REFERENCES
Web References
● https://www.geeksforgeeks.org/c-programming-language/?ref=leftbar
● https://github.com/topics/c-language
● https://www.programiz.com/c-programming
● https://www.tutorialspoint.com/cprogramming/index.htm
● https://www.programiz.com/c-programming/examples

You might also like