Programming in C and Data Structures: September 2014
Programming in C and Data Structures: September 2014
net/publication/263338168
CITATIONS READS
0 8,530
1 author:
Dr.Chandrakant Naikodi
MNC,Bangalore
69 PUBLICATIONS 40 CITATIONS
SEE PROFILE
Some of the authors of this publication are also working on these related projects:
Publishing two books : Python Applications Programming and Fundamentals of Computer Programming View project
All content following this page was uploaded by Dr.Chandrakant Naikodi on 11 March 2015.
Programming in C and
Data Structures
CHANDRAKANT N
i i
i i
i i
ABOUT AUTHOR
• Dr.Chandrakant N
Dr.Chandrakant Naikodi is presently working as a Senior Software Engineer in MNC,
Bangalore, India. He has successfully accomplished DCS, BE, ME and PhD degrees in
Computer Science and Engineering. He has published many research papers in referred
International Journals and Conferences. He is the author of two other technical books
namely “C:Test Your Aptitude” and “1000 Questions and Answers in C++” published by
Tata Mc-Graw Hill. His area of interest includes Computer Networks, MANETs, WSN,
Programming Languages etc.
PREFACE
• These days IT communities of Computer Science are encouraged to dive into different
languages and C language stands first among them. The C language is one of the popular
Computer Language, it has its own standard specifications. This book concentrates
on C introduction, syntaxes, examples,etc. I Dr.Chandrakant, as the author of this
work will appreciate the suggestions or feedback from readers and users of this book;
kindly communicate via email addresses chandrakant.naikodi@{yahoo.in, gmail.com,
facebook.com}.
i i
i i
i i
ACKNOWLEDGEMENTS
My deep gratitude and thanks to my wife Mrs. Vidyadhare Chandrakant and my daughter
Vaishnavi N for their immense patience, prayers and support. My sincere thanks to my father
Mr. Dharmanna and mother Mrs. Shanthabhai Dharmanna for their blessings and support. I
thank my brothers Mr. Shankar N, Mr. Surykant N, father-in-law Mr. Venkatesh J, mother-in-
law Mrs. Kalavathi V, my brother-in-law Mr. Nataraj and Mr. Raghavendra.
I am greatly thankful to my well wishers and teachers, especially late Sri. B C Bhavikatti, Sri.
M S Stavermat, Sri. M B Naikodi, Dr. Badrinath GS, Smt. Anita Kanavalli, Sri. Sanjeevkumar
Chetti and Smt.Sushma B Malipatil who supported and encouraged me greatly in all steps.
This book could not be completed without the support of my friends and the help of several
individuals who extended their valuable support in the preparation and compilation of this
book.
i i
i i
i i
i i
i i
i i
Contents
1 INTRODUCTION to C LANGUAGE 1
1.1 Pseudocode Solution to Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.2 Basic Concepts of a C Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.3 Declaration, Assignment and Print Statement . . . . . . . . . . . . . . . . . . . . . 3
1.4 Types of Operators and Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.5 Programming Examples and Exercise . . . . . . . . . . . . . . . . . . . . . . . . . 13
i i
i i
i i
ii
i i
i i
i i
iii
i i
i i
i i
Chapter 1
INTRODUCTION to C
LANGUAGE
C is a programming language which born at ”AT & T”s Bell Laboratory of USA in 1972. C
was written by Dennis Ritchi which is derived from B programming language and B was
derived from BCPL. A programming language is a formal constructed language intended to
communicate via instructions to a computer. A program written in 1s and 0s is called as a
machine language. As an alternative to binary bits (0/1), programmers started using English-
like words as commands that can be easily understood by users called assembly language.
Procedure-oriented languages are called high-level languages(HLL). The programmer does not
require remembering the architecture and registers of a CPU for developing a program. The
compilers are used to interpret high-level language program to a machine language. HLL are
COBOL, FORTRAN, BASIC, C, C++, Java etc.
C programming is one of the most popular computer programming languages that allow users
to create instructions for a computer to execute some task.
i i
i i