Discover millions of audiobooks, ebooks, and so much more with a free trial

From $11.99/month after trial. Cancel anytime.

Computer Programming In C Language
Computer Programming In C Language
Computer Programming In C Language
Ebook379 pages3 hours

Computer Programming In C Language

Rating: 4 out of 5 stars

4/5

()

Read preview

About this ebook

Computer Programming In C Language : Computer Programming In C Language teaches the generic Programming techniques using C programming language in an easy-to-follow style, without assuming previous experience in any other language. A variety of examples make learning these Concepts with C both fun and practical. This book is organized in such a manner that students and programmers with prior knowledge of Programming can find it easy, crisp and readable. Each Chapter contains many example programs throughout the book, along with additional examples for further practice.

KEY FEATURES
Systematic approach throughout the book

Programming basics in C without requiring previous experience in another language

Simple language has been adopted to make the topics easy and clear to the readers

Topics have been covered with numerous illustrations and tested C programs

Enough examples have been used to explain various Programming Constructs effectively. This book also consists of tested programs so as to enable the readers to learn the logic of programming

Discusses all generic concepts of Computer Programming concepts such as Algorithms, Flowcharts, Conditional and Looping Structures and Array in detail with aided examples

Use of Various Programming terms like variables and expressions, functions are simplified

A number of diagrams have been provided to clear the concepts in more illustrative way

Provides exercises, review questions and exercises as the end of each chapter equipped with many questions in various patterns and numerous programming exercises

Samples are presented in easy to use way through Turbo C 3.0.
LanguageEnglish
PublishereBookIt.com
Release dateApr 26, 2016
ISBN9781456611682
Computer Programming In C Language

Read more from Jitendra Patel

Related to Computer Programming In C Language

Related ebooks

Programming For You

View More

Reviews for Computer Programming In C Language

Rating: 4 out of 5 stars
4/5

15 ratings2 reviews

What did you think?

Tap to rate

Review must be at least 10 words

  • Rating: 1 out of 5 stars
    1/5

    Jan 8, 2018

    I don't like it....worst app don't download it ... everything is purchasable
  • Rating: 5 out of 5 stars
    5/5

    Apr 9, 2021

    great concise explanation of key features in C
    5 stars

Book preview

Computer Programming In C Language - Jitendra Patel

Computer Programming In C Language

  Volume-I 

                By Jitendra Patel

Overview

Computer Programming In C Language (Volume-I): Computer Programming In C Language teaches the generic Programming techniques using C programming language in an easy-to-follow style, without assuming previous experience in any other language. A variety of examples make learning these Concepts with C both fun and practical. This book is organized in such a manner that students and programmers with prior knowledge of Programming can find it easy, crisp and readable. Each Chapter contains many example programs throughout the book, along with additional examples for further practice.

KEY FEATURES

Systematic approach throughout the book

Programming basics in C without requiring previous experience in another language

Simple language has been adopted to make the topics easy and clear to the readers

Topics have been covered with numerous illustrations and tested C programs

Enough examples have been used to explain various Programming Constructs effectively. This book also consists of tested programs so as to enable the readers to learn the logic of programming

Discusses all generic concepts of  Computer Programming concepts such as Algorithms, Flowcharts, Conditional and Looping Structures and Array  in detail with aided examples

Use of Various Programming terms like variables and expressions, functions are simplified

A number of diagrams have been provided to clear the concepts in more illustrative way

Provides exercises, review questions and exercises as the end of each chapter equipped with many questions in various patterns and numerous programming exercises

Samples are presented in easy to use way through Turbo C 3.0.  

Copyright © 2012 Jitendra Patel

Computer Programming In C Language (Volume-I)

All rights reserved. No part of this book shall be reproduced, stored in a retrieval system, or transmitted by any means, electronic, mechanical, photocopying, recording, or otherwise, without written permission from the publisher. No patent liability is assumed with respect to the use of the information contained herein. Although every precaution has been taken in the preparation of this book, the publisher and author assume no responsibility for errors or omissions. Nor is any liability assumed for damages resulting from the use of the information contained herein.

Warning and Disclaimer

Every effort has been made to make this book as complete and as accurate as possible, but no warranty or fitness is implied. The information provided is on an as is basis. The authors and the publisher shall have neither liability nor responsibility to any person or entity with respect to any loss or damages arising from the information contained in this book.

Table of Contents

UNIT 1 Flowchart and Algorithm

1.1 Introduction

1.2 Flowchart

1.2.1 Symbols of Flowchart

Flow lines

Terminals

Input/Output

Processing

Decision

Connector (inspection)

Off-page connectors

1.2.2 Guidelines for preparing Flowchart

1.2.3 Flowchart structure

1. Sequence

2. Selection

3. Repetition

Controlling a Repetition Structure

A Pre-Test Repetition Structure

A Post-Test Repetition Structure

1.2.3 Case Structure

1.2.4 Combining Structures

1.2.5 Flowchart Examples

1.2.6 BENEFITS OF USING FLOWCHARTS

1.2.7 LIMITATIONS OF USING FLOWCHARTS

1.3 Algorithm

1.3.1 Definition

1.3.2 Characteristics of an Algorithm

1.3.3 Algorithm Notation

1.3.4 Different patterns of algorithms

1.3.5 Examples of Algorithm

1.3.6 Examples Using Flowchart and Algorithm

1.3.7 Advantages of Algorithm

1.3.8 Disadvantage of algorithm

Exercise

UNIT 2 Basics of C

2.1 Introduction

2.2 Basics of C language

2.3 History of C

2.4 Versions of C

2.4.1 Common C (Bell Labs C or K & R C or Classic C)

2.4.2 ISO/ANSI Standard

2.5 Features Of C Language

2.6 C is middle level language

2.7 C is system programming language

2.8 Applications of C language

2.9 Advantages of C language

2.9.1 C Program Development Cycle

2.9.2 Using an Editor

Using Turbo C

2.10 Debugging

2.10.1 Syntax Errors

2.10.2 Logical Errors

2.11 General structure of C program

2.11.1 Documentation Section

2.11.2 Link Section

2.11.3 Definition Section

2.11.4 Global Declaration Section

2.11.5 MAIN () Function Section

2.11.6 Subprogram Section

2.11.7 Example program: Printing a message

2.12 Standard/preprocessor directives

2.12.1 Why is it called Preprocessor?

2.12.2 Why are preprocessor directives useds?

2.12.3 HOW PREPROCESSOR directives work?

2.12.4 Categories of Preprocessor directives

2.12.5 Header Files

2.13 The Main() function

2.13.1 Comments

2.14 Character set

2.15 C Statements

2.16 ‘C’ tokens/Grammer

2.16.1 Keywords

2.16.2 Identifiers

2.16.3 Tri-graph Sequences

2.16.4 Constants

Integer Constants

Real Constants

Character Constants

String Constants

Escape Sequences

2.17 Variables

2.17.1 Rules for defining variables

2.17.2 Declaration of Variables

Declaration of Multiple Variables

2.17.3 Initialization of Variables

2.17.4 Dynamic initialization

2.17.5 Variable scope

Block or function Scope

Program Scope

File Scope

2.17.6 Variable life time

2.17.7 Storage classes for variable

Auto

Static

Extern

Register

2.18 Data types

2.18.1 Primary data type or In-built data type

Character Data Type

Integer Data Type

Floating Point Types or Real Data Type

Void Type

Sample program illustrating each data type

2.18.2 User defined data type

The enum keyword

typedef (Using Type Definitions)

2.18.3 Type modifiers

Need of Data Modifiers

Signed

Unsigned

Short

long

Constant

Volatile Variable

2.18.4 Type Conversion

Implicit type conversion

Explicit Conversion

Exercise

Questions

Programming Exercise

UNIT 3. Operators and Expression

3.1 Introduction of different types of operators

3.1.1 types of operators

3.1.2 Properties of operator

3.1.3 Arithmetic operators

Unary Arithmetic Operators

Binary Arithmetic Operators

3.1.4 Relational operators

3.1.5 Assignment operators and expressions

Combined Assignment/Compound Assignment Operators

3.1.6 Logical operators

3.1.7 Bitwise operators

Bitwise shift operators

3.1.8 conditional operator

3.1.9 Comma operator (,)

3.1.10 The size of Operator

3.2 Priority of operator and their clubbing

3.2.1 C Expressions

Converting Algebraic Expressions to C Expressions

3.2.2 Evaluation of Expressions

3.2.3 Clubbing of operators

3.2.4 Priority (Precedence) and associativity of operators

3.3 Formatted and unformatted input and output in C

3.3.1 Formatted I/O Functions

printf() function

scanf() Function

3.3.2 UnFormatted I/O Functions

getch() function

getche() function

getchar() function

putchar() function

gets() and puts() functions

Conversion Specifiers

Formatting Output

Exercise

Questions:

Programming Exercise

Unit 4 Decision Statement

4.1 Introduction

4.1.1 Why Decision Control Statements?

4.2 If statement

4.3

If-else statement

4.4

Nested If-else statement

4.5 If-else-if Ladder statement

4.6 Break, Continue and Goto Statements

4.6.1 Break Statement

4.6.2 Continue Statement

Difference between Break & Continue

4.6.3 Goto Statement

4.7

Switch Statements

Programs

Exercise

Programs

Unit 5 Loop Control Statement

5.1 Introduction

5.1.1 What Is Loop Control Statement?

5.2

for loop

Programs

5.3 Nested for loop

Programs

5.4 While loop

5.5 Do-while loop

Difference between while and do...while

Programs

Exercise

Programs

Unit 6 Introduction of Array (one dimensional)

6.1 Introduction

6.2 Array Terminology

Array Application

6.3 Array Declaration

Different declaration of array:

6.4 Array initialization

During compilation:

During execution:

6.5 Accessing an array

6.6 Storing value in an array

6.7 Array of String

6.8 Characteristic of an Array

Programs

Exercise

Programs

PART1

UNIT 1 Flowchart and Algorithm

1.1 Introduction

A computer can’t understand the problem nor it solves it – it can only perform a set of predefined operations. The programmer’s has to convert the given problem into a set of instructions to solve the problem.

Let us take an example. Suppose you want to pick up a book from a table. For a human being, it is enough to say, Please pick up the book form the table. He will go to the table and pick up the book. On the hand, imagine a totally dumb servant, who cannot reason out anything by himself but can faithfully follow your instructions.  For him you have to describe the operation in steps like:

Go to your left by 5 steps

Go forward by 10 Steps

Align yourself in front of the table

Stretch your hand to hold the book

Lift the book and hold it in your hand.

A computer can be likened to the servant. So, you as a programmer  will  have  to  break  the  problem  into  a  sequence of steps,  similar  to  those described above for the computer to work with. For this you should know the computer’s language. One of them is C. But before that, you should be able to break the problem into the simple steps so that you can describe these steps in the language.

In simple cases, you would be able to do it straightaway. With some practice, most of the simple or even medium-sized problems can be directly coded into the computer language. But when you have really complicated problems on hand, you need to analyze it step by step. Flowchart and algorithms are the way to start working with the problems and them converting them into the program of any language. So let’s start learning flowchart and algorithm.

1.2 Flowchart

It is diagrammatic or pictorial representation of an algorithm. In other words A flowchart is a diagrammatic representation that explains the sequence of operations to be performed to solve a problem.

1.2.1 Symbols of Flowchart

Various symbols are used to write different instructions/operations in the flowchart. All symbols are connected among themselves to indicate the flow of information and processing.

Flow lines

Flow lines are indicated using arrow or lines. They are used to indicate flow of the problem. An arrow coming from one symbol and ending at another symbol represents that control passes to the symbol the arrow points to.  The flow line connects the various symbols.

The flow of control is shown by these connecting lines where the normal flow goes from top to bottom or left to right. Unless otherwise shown by arrowheads on the lines. (Eg. Going upwards)

Terminals

Terminals are used to indicate beginning and end of the flowchart.

For this purpose Start and end symbols are used and are represented as ovals or rounded rectangles, usually containing the word Start or End.

Input/Output

Input and output are represented as a parallelogram.

Examples: Get X from the user; display X.

Processing

Processing steps are represented as rectangles.

Examples: Add 1 to X; replace identified part; save changes or similar.

Decision

Decisions (Conditions) in flowchart are represented as a diamond (rhombus).

These typically contain a Yes/No question or True/False test. This symbol is unique in that it has two arrows coming out of it, usually from the bottom point and right point, one corresponding to Yes or True, and one corresponding to No or False. The arrows should always be labeled.

 Example: Check if X is Positive or Negative?

Enjoying the preview?
Page 1 of 1