Share E-Book

C Programming Language Quick Start Guide Simplified C Programming For Beginners (C Programming, C Programming Language, C… (R.J. Khan)(Z-Library)

Author

Rating No ratings yet

Log in to rate

C
Language English

No Description

Format PDF
Size 675.2 KB
8
Views
(First 20 pages)

Registered users can read the full content for free

Register as a Gaohf Library member to read the complete e-book online for free and enjoy a better reading experience.

Page 1
(This page has no text content)
Page 2
Programming Language Quick Start Guide
Page 3
Simplified Guide for Beginners By: R.J. KHAN
Page 4
Introduction Are you looking for a simple, complete and quick reference for programming in C? If yes, you’ll find this book more useful than any other book out there. The book presents the general-purpose language, step by step. The book is written following a programmer’s approach and is therefore ideal for using as a quick guide and reference. The book is highly recommended for students as their first or second programming course. It covers all the basic concepts of programming in detail like Operators, Functions, Decision making statements, Pointers, Arrays and Strings. The best thing about the book is the Source code along with output at the initial stages of book. Other than students, the book is pretty helpful for professionals as well since it has a thorough and detailed indexing of topics in each chapter. The book allows the audience to be selective by reducing the inter- connectivity in the topics. We start with an overview of whole language, which involves brief history, basic
Page 5
features of C, comparison and contrast with other languages. Then we move on to familiarizing the readers with C programs and syntax. We discuss the important components of syntax individually and in detail. This section has source code in it, which helps building the interest, and learning of the audience. We study in detail about the Functions in C. The book discusses the built in functions as well as describes the rules and basics of writing your own functions. The chapter also includes programming examples. Arrays, pointers and Strings are strong points of C language and hence are discussed separately in one chapter. The topics are closely related, hence comparisons and contrasts are worth the discussion. We have an entire chapter dedicated to Binary Trees because of their importance. We discussed Abstract Data types as well as studied the examples of Stacks, Queues and Linked lists. The book illustrates the general purpose use of programming language C, detailed
Page 6
documentation of features provided by C, the working source code, along with comparison between object oriented language, C++. The differences between ANSI C and traditional language “C” are elaborated in detail as well. R.J. Khan Copyright 2015 by R.J. Khan All rights reserved. This document is geared towards providing exact and reliable information in regards to the topic and issue covered. The publication is sold with the idea that the publisher is not required to render accounting, officially permitted, or otherwise, qualified services. If advice is necessary, legal or professional, a practiced individual in the profession should be ordered. - From a Declaration of Principles which was accepted and approved equally by a Committee of the American Bar Association and a Committee of Publishers and Associations. In no way is it legal to reproduce, duplicate, or transmit any part of this document in either electronic means or in printed format. Recording of this publication is strictly
Page 7
prohibited and any storage of this document is not allowed unless with written permission from the publisher. All rights reserved. The information provided herein is stated to be truthful and consistent, in that any liability, in terms of inattention or otherwise, by any usage or abuse of any policies, processes, or directions contained within is the solitary and utter responsibility of the recipient reader. Under no circumstances will any legal responsibility or blame be held against the publisher for any reparation, damages, or monetary loss due to the information herein, either directly or indirectly. Respective authors own all copyrights not held by the publisher. The information herein is offered for informational purposes solely, and is universal as so. The presentation of the information is without contract or any type of guarantee assurance. The trademarks that are used are without any consent, and the publication of the trademark is without permission or backing by the trademark owner. All trademarks
Page 8
and brands within this book are for clarifying purposes only and are the owned by the owners themselves, not affiliated with this document. TABLE OF CONTENTS
Page 9
Chapter 1 Let’s C………………………………………………………………6 1. Background……………………………………………………………….6 2. ANSI C……………………………………………………………………...7 3. Strengths of C…………………………………………………………… 8 4. Programming in C……………………………………………………..9 5. Nothing is Perfect……………………………………………………..10
Page 10
Chapter 2 Tokens and Syntax…………………………………………..11 1. Preprocessors…………………………………………………………….1 1 2. Variables…………………………………………………………………… 14 3. Constants………………………………………………………………….. 16 4. Keywords…………………………………………………………………..1 7 5. Character Constants…………………………………………………… 18 6. Operators and Punctuators…………………………………………23 7. Precedence and Associativity………………………………………33
Page 11
Chapter 3 Data Types………………………………………………………………37 1. Integral Data Types…………………………………………………… 38 2. Floating point…………………………………………………………… 38 3. Using ‘typedef’ ……………………………………………………..…… 39 4. Storage classes…………………………………………………………..39 5. Default Initializers…………………………………………………….43
Page 12
Chapter 4 Loops and Decisions………………………………………..44 1. If else……………………………………………………………44 2. Switch case…………………………………………………….46 3. For loop………………………………………………………….48 4. While loop………………………………………………………50 5. Do while loop…………………………………………………….51 6. Nested Loops…………………………………………………….52
Page 13
Chapter 5 Functions……………………………………….……………….54 1. Function Definition……………………………………………54 2. Function Prototypes ………………………………………….57 3. Alternative Declarations……………………………………..58 4. Function Invocation……………………………………………59 5. Environment……………………………………………………..60 6. Recursion………………………………………………………….61 7. Examples…………………………………………………………..62
Page 14
Chapter 6 Arrays, Strings and Pointers………………………………66 1. 1-D Arrays…………………………………………………………66 2. Pointers…………………………………………………………...68 3. Strings……………………………………………………………...72 4. 2D-Arrays…………………………………………………………75 5. 3D-Arrays…………………………………………………………76
Page 15
Chapter 7 Structures ……………………………………………………….77 1. Declaration……………………………………………………..77 2. Memory Allocation………………………………………….78 3. Member Access operators………………………………..79 4. Definition……………………………………………………….80 5. Abstract Data Types…………………………………………81
Page 16
Chapter 8 Binary Search Tree…………………………………………..90 1. Composition…………………………………………………… 90 2. Insert Function………………………………………………..91 3. Search Function……………………………………………….92 Conclusion Chapter 1: Let’s C This chapter gives an overview of the C programming language. We start with a brief background and discuss pros and cons of the general-purpose language. After that, a series of programs follows, and the elements of each program are carefully, line-by-line explained. We emphasize on how to use the basic input/output functions of C. As we discuss in detail the similarities between C and C++, you can fairly assume that the programs written are syntactically correct for both the languages and the concepts elaborated are also common. Of course, the C++ programmer has more capabilities
Page 17
using the object oriented programming concepts. We recommend that everyone reads this chapter out so that they know the basics about C and programming in C. Everyone should read this chapter even if they don’t understand everything because everything is explained in detail later on, in the book but the introduction in this chapter is important. 1.1 Background: C is a procedural programming language that was originally designed by Dennis Ritchie at Bell in 1972. UNIX operating system used it as the systems language. C was designed to overcome the shortcomings of a programming language B, which was designed by K. Thompson while working on initial versions of UNIX. B was a programming language based on BCPL, a type less systems programming language, developed by Martin Richards in 1967. Its basic data type was the machine word, and it made heavy use of pointers and address arithmetic. It is completely different from traditional structural programming, which involved use of typed commands. Although C initially evolved from Band BCPL, but it included typing.
Page 18
By the early 1980s, the language has transformed itself into what it looks like today, commonly known as the traditional C. ANSI standard C was introduced in the later part of the same decade. The committee added the void, function prototypes, a new function definition syntax, and more functionality for the preprocessor, and in general made the language definition more precise. ANSI C maintained its standard in an amazing way that it is still used in many programs as a system language. It is one of the most commonly used programming languages of the world, and it is found in colleges and universities for learning purposes. It is mostly the first programming course offered to any IT students. C++ is an extension of ANSI standard C which incorporates the object oriented programming paradigm, which kind of revolutionized the programming world. This book describes the ANSI version of the C language, along with some topics in C++ as well. 1.2 ANSI Standard C: ANSI stands for "American National Standards Institute." This institute is involved in
Page 19
setting standards for different systems, including programming languages. Standards are important in a sense that everyone can have his own perspective. For example, while travelling in a train, what seems to be stationary for you, might be moving for someone outside the train. ANSI Committee X3Jl1 is responsible for setting the standard for the programming language C. In the late 1980s, the committee created draft standards for what is known as ANSI C or standard C. In 1990, the International Organization for Standardization (ISO) approved the standard for ANSI C as well. Thus, ANSI C, or ANSI/ISO C, is an internationally recognized standard for programming in C. The standard specifies the form in which programs are written in C and defines the standards for how these programs are to be interpreted. The standardization results in better portability, reliability, maintainability, and efficient execution of C language programs on different machines. All the compilers follow this standard and hence there is uniformity in interpretation of code. 1.3 Strengths of C:
Page 20
The programming languages that are being used today are so powerful that nothing remains impossible. But this power depends directly on how vast a language is, which is determined by number of reserved keywords. C has fewer keywords than Pascal, but it is more powerful than it. The power of C lies in the unrestricted structure of programming in it. Although, C has its limitations like any other language but it comes as the best in its capacity. Because C is a small language, hence it is ideal to start your programming career from it. It is easy to master when compared with other languages. Once you have mastered C, you can then easily move on to the more powerful and vast languages. We will now briefly discuss the strong characteristics of C, which will motivate the readers to program in C. • UNIX is a major interactive operating system on workstations, servers, and mainframes. C is the basic language used on UNIX platform. Many windowing packages, database programs, graphics libraries, and other large- application packages are written in C.
The above is a preview of the first 20 pages. Register to read the complete e-book.

Recommended for You

Loading recommended books...
Failed to load, please try again later

Tip the Site

Scan the WeChat Pay or Alipay code to tip. No login required.

WeChat Pay
Alipay
← Back to List