Programming in C 1. Bharat Kinariwala Tep Dobry. 1 Copyright c1993 by B.Kinariwala and T. Dobry. All rights reserved.

Size: px
Start display at page:

Download "Programming in C 1. Bharat Kinariwala Tep Dobry. 1 Copyright c1993 by B.Kinariwala and T. Dobry. All rights reserved."

Transcription

1 Programming in C 1 Bharat Kinariwala University ofhawai`i Tep Dobry University ofhawai`i January 5, Copyright c1993 by B.Kinariwala and T. Dobry. All rights reserved.

2 Contents Table of Contents i List of Figures vii List of Tables xiii Preface xvii 1 Introduction Computer System Organization : : : : : : : : : : : : : : : : : : : : : : : : : : : : Computer Hardware : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Computer Software { The Operating System : : : : : : : : : : : : : : : : : Utility Programs : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : User Programs and Applications : : : : : : : : : : : : : : : : : : : : : : : : Representing Data and Program Internally : : : : : : : : : : : : : : : : : : : : : : Representing Data : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Main Memory : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Representing Programs : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Designing Programs and the C Language : : : : : : : : : : : : : : : : : : : : : : : Designing The Algorithm : : : : : : : : : : : : : : : : : : : : : : : : : : : : The C Language : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Summary : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 24 i

3 ii CONTENTS 1.5 References : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Exercises : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Problems : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 28 2 Basic Concepts A Simple C Program : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Developing the Algorithm : : : : : : : : : : : : : : : : : : : : : : : : : : : Translating the Algorithm to C : : : : : : : : : : : : : : : : : : : : : : : : Running the Program : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Organization of C Programs Simple Statements : : : : : : : : : : : : : : : : : : Comment Statements : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Dening a Function main() : : : : : : : : : : : : : : : : : : : : : : : : : Variable Declarations : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : The Assignment Statement : : : : : : : : : : : : : : : : : : : : : : : : : : Generating Output : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Testing the Program : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Debugging the Program : : : : : : : : : : : : : : : : : : : : : : : : : : : : Documenting the Code : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Input: Reading Data : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : More C Statements : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Making Decisions with Branches : : : : : : : : : : : : : : : : : : : : : : : : Simple Compiler Directives : : : : : : : : : : : : : : : : : : : : : : : : : : More on Expressions : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : A Simple Loop while : : : : : : : : : : : : : : : : : : : : : : : : : : : : Controlling Loop Termination : : : : : : : : : : : : : : : : : : : : : : : : : More Complex Loop Constructs Nested Loops : : : : : : : : : : : : : : Common Errors : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 78

4 CONTENTS iii 2.7 Summary : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Exercises : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Problems : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 86 3 Designing Programs Top Down Designing the Algorithm with Functions : : : : : : : : : : : : : : : : : : : : : : : Implementing the Program with Functions : : : : : : : : : : : : : : : : : : Dening Functions : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Passing Data to and from Functions : : : : : : : : : : : : : : : : : : : : : : Call by Value and Local Variables : : : : : : : : : : : : : : : : : : : : : : : Coding Programs for Readability : : : : : : : : : : : : : : : : : : : : : : : : : : : The C Preprocessor : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Macros : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Including Header Files : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Conditional Compilation : : : : : : : : : : : : : : : : : : : : : : : : : : : : Interacting with the Operating System : : : : : : : : : : : : : : : : : : : : : : : : Standard Files and EOF : : : : : : : : : : : : : : : : : : : : : : : : : : : : Standard Files and Redirection : : : : : : : : : : : : : : : : : : : : : : : : Debugging Guidelines : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Common Errors : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Summary : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Exercises : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Problems : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Processing Character Data A New Data Type: char : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : The ASCII Character Set : : : : : : : : : : : : : : : : : : : : : : : : : : : 138

5 iv CONTENTS Operations on Characters : : : : : : : : : : : : : : : : : : : : : : : : : : : Character I/O Using getchar() and putchar() : : : : : : : : : : : : : : : Strings vs Characters : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Sample Character Processing Functions : : : : : : : : : : : : : : : : : : : : : : : : Converting Letter Characters : : : : : : : : : : : : : : : : : : : : : : : : : Converting Digit Characters to Numbers : : : : : : : : : : : : : : : : : : : Counting Words : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Extracting Words : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : New Control Constructs : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : The switch Statement : : : : : : : : : : : : : : : : : : : : : : : : : : : : : The break Statement : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : The continue Statement : : : : : : : : : : : : : : : : : : : : : : : : : : : : Mixing Character and Numeric Input : : : : : : : : : : : : : : : : : : : : : : : : : Menu Driven Programs : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Common Errors : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Summary : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Exercises : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Problems : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Numeric Data Types and Expression Evaluation Representing Numbers : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Signed and Unsigned Integer Types : : : : : : : : : : : : : : : : : : : : : : Single and Double Precision Floating Point Numbers : : : : : : : : : : : : New Control Constructs : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : The for Statement : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : The do...while Statement : : : : : : : : : : : : : : : : : : : : : : : : : : Scalar Data Types : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 224

6 CONTENTS v Data Type void : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Enumeration : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Dening User Types: typedef : : : : : : : : : : : : : : : : : : : : : : : : : Operators and Expression Evaluation : : : : : : : : : : : : : : : : : : : : : : : : : Precedence and Associativity : : : : : : : : : : : : : : : : : : : : : : : : : TheDataType of the Result : : : : : : : : : : : : : : : : : : : : : : : : : Some New Operators : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Common Errors : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Summary : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Exercises : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Problems : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Pointers What is a Pointer? : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Data vs Address : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Indirect Access of Values : : : : : : : : : : : : : : : : : : : : : : : : : : : : Passing Pointers to Functions : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Indirectly Incrementing a Variable : : : : : : : : : : : : : : : : : : : : : : : Computing the Square and Cube : : : : : : : : : : : : : : : : : : : : : : : A function to Swap Values : : : : : : : : : : : : : : : : : : : : : : : : : : : Returning to the Payroll Task with Pointers : : : : : : : : : : : : : : : : : : : : : Common Errors : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Summary : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Exercises : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Problems : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Arrays 293

7 vi CONTENTS 7.1 A Compound Data Type array : : : : : : : : : : : : : : : : : : : : : : : : : : : Declaring Arrays : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Character Strings as Arrays : : : : : : : : : : : : : : : : : : : : : : : : : : Passing Arrays to Functions : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Arrays, Pointers, Pointer Arithmetic : : : : : : : : : : : : : : : : : : : : : : : : : Pointers: Increment and Decrement : : : : : : : : : : : : : : : : : : : : : : Array Names vs Pointer Variables : : : : : : : : : : : : : : : : : : : : : : : String Assignment and I/O : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Array Initializers : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Arrays for Databases : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Common Errors : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Summary : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Exercises : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Problems : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Functions and Files Sorting and Searching String Processing Two Dimensional Arrays Structures and Unions File Input/Output Storage Class and Scope Engineering Programming Examples 353

8 CONTENTS vii A C Language Reference 355 B ANSI C vs Old C 357 C The C Standard Library 359

9 viii CONTENTS

10 List of Figures 1.1 Computer System Block Diagram : : : : : : : : : : : : : : : : : : : : : : : : : : : Memory and Addresses : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : CPU and Memory Conguration : : : : : : : : : : : : : : : : : : : : : : : : : : : Machine and Assembly Language Program Fragment : : : : : : : : : : : : : : : : Structural Diagram for Payroll Task : : : : : : : : : : : : : : : : : : : : : : : : : : Flow Chart for Payroll Task : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Code for pay0.c : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Allocation of Memory Cells or Objects : : : : : : : : : : : : : : : : : : : : : : : : AssignmentofValues : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Computation of pay : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Program Trace for pay0.c : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Keyboard Buer : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Code for pay1.c : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : If statement control ow : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Code for pay2.c : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Control Flow for while statement : : : : : : : : : : : : : : : : : : : : : : : : : : : Coding a While Loop : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Code for pay3.c : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Code for pay4.c : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Code for prime.c : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 77 ix

11 x LIST OF FIGURES 3.1 Structural Diagram for Payroll Task : : : : : : : : : : : : : : : : : : : : : : : : : : Code for pay5.c driver : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Function Call to calc pay() : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Code for calc pay() : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Function Call Trace : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Trace for calc pay() : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Call by value variable allocation : : : : : : : : : : : : : : : : : : : : : : : : : : : : Local Variables in Blocks : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Driver for niceday.c : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Functions for niceday.c : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Using Directives in niceday.c : : : : : : : : : : : : : : : : : : : : : : : : : : : : : End of File Marker : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Code for maxabs.c : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Code for copy0.c : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Code for ASCII Attributes : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Printing character representations : : : : : : : : : : : : : : : : : : : : : : : : : : : Alternate code for attributes program : : : : : : : : : : : : : : : : : : : : : : : : : Using getchar() and putchar() : : : : : : : : : : : : : : : : : : : : : : : : : : : Strings : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Code for upper case : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Code for Character Utilities : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Header le for Character Utilities : : : : : : : : : : : : : : : : : : : : : : : : : : : Code for getint() : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Revised Character Utility Header File : : : : : : : : : : : : : : : : : : : : : : : : : Revised Character Utility Code : : : : : : : : : : : : : : : : : : : : : : : : : : : : Code for Count Words Driver : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 166

12 LIST OF FIGURES xi 4.14 Header Files for Word Count : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Code for Word Count Utility Functions : : : : : : : : : : : : : : : : : : : : : : : : Code fore extracting words : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Control Flow for switch statement : : : : : : : : : : : : : : : : : : : : : : : : : : : Code for vowelp() Using a switch Statement : : : : : : : : : : : : : : : : : : : : Code for encrypt.c : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Implementing print next() Using a switch Statement : : : : : : : : : : : : : : : New Implementation of print category using switch : : : : : : : : : : : : : : : Extracting Words Using break : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Code for Revised encrypt.c : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Code for Testing scanf() : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Revised Code for Reading Integers : : : : : : : : : : : : : : : : : : : : : : : : : : Mixing Numeric and Character Data : : : : : : : : : : : : : : : : : : : : : : : : : Revised Code for Mixing Data : : : : : : : : : : : : : : : : : : : : : : : : : : : : : A Better Revision for Mixing Data : : : : : : : : : : : : : : : : : : : : : : : : : : Code for menu driven program : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Menu Driven Functions : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Control Flow offor Loop : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Code for factorial : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Control Flow ofdo...while Loop : : : : : : : : : : : : : : : : : : : : : : : : : : : Code for Square Root : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Code for Math Utilities : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Modied Square Root Driver : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Modied Square Root Utilities : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Code for Simple Postx Calculator : : : : : : : : : : : : : : : : : : : : : : : : : : Code for get operator() : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 231

13 xii LIST OF FIGURES 5.10 Factorial Function Using Composite Operators : : : : : : : : : : : : : : : : : : : : Function maxdbl Using a Conditional Expression : : : : : : : : : : : : : : : : : : Revised Fibonacci : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Testing sizeof Operator : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Declaring Pointer Variables : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Declaration of Pointer Variables : : : : : : : : : : : : : : : : : : : : : : : : : : : : Assignments of pointers : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Eect of Pointer to Pointer Assignment : : : : : : : : : : : : : : : : : : : : : : : : Eect of Pointer Reassignment : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Eect of Indirect Pointer Access and Assignment : : : : : : : : : : : : : : : : : : Eect of Indirect Assignment : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Eect of Indirect Pointer Access and Assignment : : : : : : : : : : : : : : : : : : Example Code with Direct and Indirect Access : : : : : : : : : : : : : : : : : : : : Trace for Direct and Indirect Access : : : : : : : : : : : : : : : : : : : : : : : : : : Code for Indirect Access by afunction : : : : : : : : : : : : : : : : : : : : : : : : Trace for Indirect Access by afunction : : : : : : : : : : : : : : : : : : : : : : : : Code for Indirectly Returned Values : : : : : : : : : : : : : : : : : : : : : : : : : : Trace for sqcube : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Trace for sqcube : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Trace for sqcube : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Trace for sqcube : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Code for a Function, swap() : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Trace for swap() : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Trace for swap() : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Trace for swap() : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Trace for swap() : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 281

14 LIST OF FIGURES xiii 6.23 Header le payutil.h : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Code for the Driver for pay6.c : : : : : : : : : : : : : : : : : : : : : : : : : : : : Code for print data() and print pay() : : : : : : : : : : : : : : : : : : : : : : : Code for calc pay() : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Code for get data() : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Code for scores.c : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : An Array of size MAX : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : A String Stored in Memory : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Code for string.c : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Code fore scores.c : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Code for string2.c : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Pointer Arithmetic : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Array Pointers as Function Parameters : : : : : : : : : : : : : : : : : : : : : : : : Pointer to a Sub-array : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Pointer Variables and Arrays : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Pointer Variables and Strings : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Data Record Spread Over Several Arrays : : : : : : : : : : : : : : : : : : : : : : : Code for paytab.c : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Code for payutil.c : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : 325

15 xiv LIST OF FIGURES

16 List of Tables 1.1 Number Representations : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Arithmetic Operators : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Relational Operators : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Precedence and Associativity of Operators : : : : : : : : : : : : : : : : : : : : : : Logical Operator Symbols in C : : : : : : : : : : : : : : : : : : : : : : : : : : : : Truth Table for Logical Combinations : : : : : : : : : : : : : : : : : : : : : : : : : Escape Sequences : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : ASCII Table : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : Escape sequences with Octal & Hexadecimal values : : : : : : : : : : : : : : : : : Precedence and Associativity Table : : : : : : : : : : : : : : : : : : : : : : : : : : Composite Assignment Operators and Their Equivalents : : : : : : : : : : : : : : Space allocation in Bytes for data types : : : : : : : : : : : : : : : : : : : : : : : Pointer Arithmetic and Indirect Access : : : : : : : : : : : : : : : : : : : : : : : : 307 xv

17 xvi LIST OF TABLES

18 Preface The C language has boomed in popularity andavailability since its creation in the 70's. It has largely become the language of choice for systems programming as well as general purpose programming in both the numeric and symbolic realms. As a result, all programmers today should have some working knowledge of C, particularly in engineering. This book is intended to be a rst text in programming in general with emphasis on the C language. It is meant for students with little or no previous programming experience and as such, a primary focus is on the top down design of programs, beginning with the development ofan algorithm, proceeding to the translation of the algorithm into a programming language (C), and the subsequent testing and debugging of the resulting code. Throughout the text, emphasis is placed on organization and readability ofcodeaswell as debugging aids in program development. In addition, understandable and functional user interfaces are described. As an introductory text on programming, our approach is to motivate the introduction of features of the language through example problems. We start with meaningful but simple tasks, develop an algorithm to solve the task and then introduce the necessary language constructs to implement the algorithm. We then rene the task, adding complexity or desirable features to motivate introduction of new language constructs. As such, the text is not meant to be a C reference manual, but a text on program design utilizing the available language features to implement the design. However, for student's reference, the key constructs introduced are summarized at the end of each chapter. The intent is for the student to be able to design and code programs from the very beginning. The book is organized as follows: Chapter 1 is an introduction to computers and some of the terminology used throughout the text. Chapter 2 begins the development of a simple C program and the introduction to the organization and basic statements of the language. Chapter 3 stresses the top down approach to design and introduces functions at an early stage to emphasize their relation to algorithms. Chapter 4 introduces the character data type and algorithms for processing characters. xvii

19 xviii PREFACE Chapter 5 presents numeric data types and their limitations and discusses the details of C expression evaluation. Chapter 6 addresses the important concept of pointers and their use in C in functions. Chapter 7 introduces compound data types with arrays and discusses their relation with pointers. Chapter 8 describes some of the standard library functions provided in C for character and math processing as well as giving a detailed description of the standard I/O functions printf() and scanf() and their variations for le I/O. Chapter 9 presents some standard sorting and searching techniques. Chapter 10 describes the powerful string processing utilities in C and the concept of libraries of functions. Chapter 11 returns to arrays presenting two dimensional arrays. Chapter 12 discusses the remaining compound data type structures and unions. Chapter 13 presents advanced le Input/Output features of the language. Chapter 14 describes the memory organization of C programs and discusses the details of storage classes and scope. Finally, Chapter 15 provides several examples of algorithms useful in Engineering computation. It makes use of the concepts presented in earlier Chapters and these examples may be discussed with the appropriate Chapter. In addition, three Appendices are provided as follows: Appendix A provides a summary of the C language constructs discussed in the text. Appendix B contrasts the language features of ANSI C as presented in this text to \old" C which is still available on many Unix systems. Appendix C summarizes the standard library functions available in C.

So far we have considered only numeric processing, i.e. processing of numeric data represented

So far we have considered only numeric processing, i.e. processing of numeric data represented Chapter 4 Processing Character Data So far we have considered only numeric processing, i.e. processing of numeric data represented as integer and oating point types. Humans also use computers to manipulate

More information

Embedded Systems. Review of ANSI C Topics. A Review of ANSI C and Considerations for Embedded C Programming. Basic features of C

Embedded Systems. Review of ANSI C Topics. A Review of ANSI C and Considerations for Embedded C Programming. Basic features of C Embedded Systems A Review of ANSI C and Considerations for Embedded C Programming Dr. Jeff Jackson Lecture 2-1 Review of ANSI C Topics Basic features of C C fundamentals Basic data types Expressions Selection

More information

C Programming. for Embedded Microcontrollers. Warwick A. Smith. Postbus 11. Elektor International Media BV. 6114ZG Susteren The Netherlands

C Programming. for Embedded Microcontrollers. Warwick A. Smith. Postbus 11. Elektor International Media BV. 6114ZG Susteren The Netherlands C Programming for Embedded Microcontrollers Warwick A. Smith Elektor International Media BV Postbus 11 6114ZG Susteren The Netherlands 3 the Table of Contents Introduction 11 Target Audience 11 What is

More information

KITES TECHNOLOGY COURSE MODULE (C, C++, DS)

KITES TECHNOLOGY COURSE MODULE (C, C++, DS) KITES TECHNOLOGY 360 Degree Solution www.kitestechnology.com/academy.php info@kitestechnology.com technologykites@gmail.com Contact: - 8961334776 9433759247 9830639522.NET JAVA WEB DESIGN PHP SQL, PL/SQL

More information

The C Programming Language course syllabus associate level

The C Programming Language course syllabus associate level TECHNOLOGIES The C Programming Language course syllabus associate level Course description The course fully covers the basics of programming in the C programming language and demonstrates fundamental programming

More information

The programming language C. sws1 1

The programming language C. sws1 1 The programming language C sws1 1 The programming language C invented by Dennis Ritchie in early 1970s who used it to write the first Hello World program C was used to write UNIX Standardised as K&C (Kernighan

More information

How To Write Portable Programs In C

How To Write Portable Programs In C Writing Portable Programs COS 217 1 Goals of Today s Class Writing portable programs in C Sources of heterogeneity Data types, evaluation order, byte order, char set, Reading period and final exam Important

More information

Sources: On the Web: Slides will be available on:

Sources: On the Web: Slides will be available on: C programming Introduction The basics of algorithms Structure of a C code, compilation step Constant, variable type, variable scope Expression and operators: assignment, arithmetic operators, comparison,

More information

B.Sc.(Computer Science) and. B.Sc.(IT) Effective From July 2011

B.Sc.(Computer Science) and. B.Sc.(IT) Effective From July 2011 NEW Detailed Syllabus of B.Sc.(Computer Science) and B.Sc.(IT) Effective From July 2011 SEMESTER SYSTEM Scheme & Syllabus for B.Sc. (CS) Pass and Hons. Course Effective from July 2011 and onwards CLASS

More information

I PUC - Computer Science. Practical s Syllabus. Contents

I PUC - Computer Science. Practical s Syllabus. Contents I PUC - Computer Science Practical s Syllabus Contents Topics 1 Overview Of a Computer 1.1 Introduction 1.2 Functional Components of a computer (Working of each unit) 1.3 Evolution Of Computers 1.4 Generations

More information

C++ Programming Language

C++ Programming Language C++ Programming Language Lecturer: Yuri Nefedov 7th and 8th semesters Lectures: 34 hours (7th semester); 32 hours (8th semester). Seminars: 34 hours (7th semester); 32 hours (8th semester). Course abstract

More information

Embedded C Programming, Linux, and Vxworks. Synopsis

Embedded C Programming, Linux, and Vxworks. Synopsis Embedded C Programming, Linux, and Vxworks. Synopsis This course is extensive and contains many advanced concepts. The range of modules covers a full introduction to C, real-time and embedded systems concepts

More information

El Dorado Union High School District Educational Services

El Dorado Union High School District Educational Services El Dorado Union High School District Course of Study Information Page Course Title: ACE Computer Programming II (#495) Rationale: A continuum of courses, including advanced classes in technology is needed.

More information

EMC Publishing. Ontario Curriculum Computer and Information Science Grade 11

EMC Publishing. Ontario Curriculum Computer and Information Science Grade 11 EMC Publishing Ontario Curriculum Computer and Information Science Grade 11 Correlations for: An Introduction to Programming Using Microsoft Visual Basic 2005 Theory and Foundation Overall Expectations

More information

AQA GCSE in Computer Science Computer Science Microsoft IT Academy Mapping

AQA GCSE in Computer Science Computer Science Microsoft IT Academy Mapping AQA GCSE in Computer Science Computer Science Microsoft IT Academy Mapping 3.1.1 Constants, variables and data types Understand what is mean by terms data and information Be able to describe the difference

More information

How To Port A Program To Dynamic C (C) (C-Based) (Program) (For A Non Portable Program) (Un Portable) (Permanent) (Non Portable) C-Based (Programs) (Powerpoint)

How To Port A Program To Dynamic C (C) (C-Based) (Program) (For A Non Portable Program) (Un Portable) (Permanent) (Non Portable) C-Based (Programs) (Powerpoint) TN203 Porting a Program to Dynamic C Introduction Dynamic C has a number of improvements and differences compared to many other C compiler systems. This application note gives instructions and suggestions

More information

CS 141: Introduction to (Java) Programming: Exam 1 Jenny Orr Willamette University Fall 2013

CS 141: Introduction to (Java) Programming: Exam 1 Jenny Orr Willamette University Fall 2013 Oct 4, 2013, p 1 Name: CS 141: Introduction to (Java) Programming: Exam 1 Jenny Orr Willamette University Fall 2013 1. (max 18) 4. (max 16) 2. (max 12) 5. (max 12) 3. (max 24) 6. (max 18) Total: (max 100)

More information

PART-A Questions. 2. How does an enumerated statement differ from a typedef statement?

PART-A Questions. 2. How does an enumerated statement differ from a typedef statement? 1. Distinguish & and && operators. PART-A Questions 2. How does an enumerated statement differ from a typedef statement? 3. What are the various members of a class? 4. Who can access the protected members

More information

Informatica e Sistemi in Tempo Reale

Informatica e Sistemi in Tempo Reale Informatica e Sistemi in Tempo Reale Introduction to C programming Giuseppe Lipari http://retis.sssup.it/~lipari Scuola Superiore Sant Anna Pisa October 25, 2010 G. Lipari (Scuola Superiore Sant Anna)

More information

Bachelors of Computer Application Programming Principle & Algorithm (BCA-S102T)

Bachelors of Computer Application Programming Principle & Algorithm (BCA-S102T) Unit- I Introduction to c Language: C is a general-purpose computer programming language developed between 1969 and 1973 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating

More information

Fundamentals of Programming and Software Development Lesson Objectives

Fundamentals of Programming and Software Development Lesson Objectives Lesson Unit 1: INTRODUCTION TO COMPUTERS Computer History Create a timeline illustrating the most significant contributions to computing technology Describe the history and evolution of the computer Identify

More information

El Dorado Union High School District Educational Services

El Dorado Union High School District Educational Services El Dorado Union High School District Course of Study Information Page Course Title: ACE Computer Programming I (#494) Rationale: A continuum of courses, including advanced classes in technology is needed.

More information

Course Title: Software Development

Course Title: Software Development Course Title: Software Development Unit: Customer Service Content Standard(s) and Depth of 1. Analyze customer software needs and system requirements to design an information technology-based project plan.

More information

PROBLEM SOLVING SEVENTH EDITION WALTER SAVITCH UNIVERSITY OF CALIFORNIA, SAN DIEGO CONTRIBUTOR KENRICK MOCK UNIVERSITY OF ALASKA, ANCHORAGE PEARSON

PROBLEM SOLVING SEVENTH EDITION WALTER SAVITCH UNIVERSITY OF CALIFORNIA, SAN DIEGO CONTRIBUTOR KENRICK MOCK UNIVERSITY OF ALASKA, ANCHORAGE PEARSON PROBLEM SOLVING WITH SEVENTH EDITION WALTER SAVITCH UNIVERSITY OF CALIFORNIA, SAN DIEGO CONTRIBUTOR KENRICK MOCK UNIVERSITY OF ALASKA, ANCHORAGE PEARSON Addison Wesley Boston San Francisco New York London

More information

/* File: blkcopy.c. size_t n

/* File: blkcopy.c. size_t n 13.1. BLOCK INPUT/OUTPUT 505 /* File: blkcopy.c The program uses block I/O to copy a file. */ #include main() { signed char buf[100] const void *ptr = (void *) buf FILE *input, *output size_t

More information

Chapter One Introduction to Programming

Chapter One Introduction to Programming Chapter One Introduction to Programming 1-1 Algorithm and Flowchart Algorithm is a step-by-step procedure for calculation. More precisely, algorithm is an effective method expressed as a finite list of

More information

Tutorial on C Language Programming

Tutorial on C Language Programming Tutorial on C Language Programming Teodor Rus rus@cs.uiowa.edu The University of Iowa, Department of Computer Science Introduction to System Software p.1/64 Tutorial on C programming C program structure:

More information

PROGRAMMING IN C PROGRAMMING IN C CONTENT AT A GLANCE

PROGRAMMING IN C PROGRAMMING IN C CONTENT AT A GLANCE PROGRAMMING IN C CONTENT AT A GLANCE 1 MODULE 1 Unit 1 : Basics of Programming Unit 2 : Fundamentals Unit 3 : C Operators MODULE 2 unit 1 : Input Output Statements unit 2 : Control Structures unit 3 :

More information

#820 Computer Programming 1A

#820 Computer Programming 1A Computer Programming I Levels: 10-12 Units of Credit: 1.0 CIP Code: 11.0201 Core Code: 35-02-00-00-030 Prerequisites: Secondary Math I, Keyboarding Proficiency, Computer Literacy requirement Semester 1

More information

Keywords are identifiers having predefined meanings in C programming language. The list of keywords used in standard C are : unsigned void

Keywords are identifiers having predefined meanings in C programming language. The list of keywords used in standard C are : unsigned void 1. Explain C tokens Tokens are basic building blocks of a C program. A token is the smallest element of a C program that is meaningful to the compiler. The C compiler recognizes the following kinds of

More information

RARITAN VALLEY COMMUNITY COLLEGE ACADEMIC COURSE OUTLINE. CISY 105 Foundations of Computer Science

RARITAN VALLEY COMMUNITY COLLEGE ACADEMIC COURSE OUTLINE. CISY 105 Foundations of Computer Science I. Basic Course Information RARITAN VALLEY COMMUNITY COLLEGE ACADEMIC COURSE OUTLINE CISY 105 Foundations of Computer Science A. Course Number and Title: CISY-105, Foundations of Computer Science B. New

More information

ASSEMBLY PROGRAMMING ON A VIRTUAL COMPUTER

ASSEMBLY PROGRAMMING ON A VIRTUAL COMPUTER ASSEMBLY PROGRAMMING ON A VIRTUAL COMPUTER Pierre A. von Kaenel Mathematics and Computer Science Department Skidmore College Saratoga Springs, NY 12866 (518) 580-5292 pvonk@skidmore.edu ABSTRACT This paper

More information

Name: Class: Date: 9. The compiler ignores all comments they are there strictly for the convenience of anyone reading the program.

Name: Class: Date: 9. The compiler ignores all comments they are there strictly for the convenience of anyone reading the program. Name: Class: Date: Exam #1 - Prep True/False Indicate whether the statement is true or false. 1. Programming is the process of writing a computer program in a language that the computer can respond to

More information

VB.NET Programming Fundamentals

VB.NET Programming Fundamentals Chapter 3 Objectives Programming Fundamentals In this chapter, you will: Learn about the programming language Write a module definition Use variables and data types Compute with Write decision-making statements

More information

The Elective Part of the NSS ICT Curriculum D. Software Development

The Elective Part of the NSS ICT Curriculum D. Software Development of the NSS ICT Curriculum D. Software Development Mr. CHEUNG Wah-sang / Mr. WONG Wing-hong, Robert Member of CDC HKEAA Committee on ICT (Senior Secondary) 1 D. Software Development The concepts / skills

More information

THE OPEN UNIVERSITY OF TANZANIA

THE OPEN UNIVERSITY OF TANZANIA THE OPEN UNIVERSITY OF TANZANIA FACULTY OF SCIENCE, TECHNOLOGY AND ENVIRONMENTAL STUDIES ODM 103: INTRODUCTION TO COMPUTER PROGRAMMING LANGUAGES Said Ally i ODM 103 INTRODUCTION TO COMPUTER PROGRAMMING

More information

10CS35: Data Structures Using C

10CS35: Data Structures Using C CS35: Data Structures Using C QUESTION BANK REVIEW OF STRUCTURES AND POINTERS, INTRODUCTION TO SPECIAL FEATURES OF C OBJECTIVE: Learn : Usage of structures, unions - a conventional tool for handling a

More information

An Introduction to Programming and Computer Science

An Introduction to Programming and Computer Science An Introduction to Programming and Computer Science Maria Litvin Phillips Academy, Andover, Massachusetts Gary Litvin Skylight Software, Inc. Skylight Publishing Andover, Massachusetts Copyright 1998 by

More information

ASCII Encoding. The char Type. Manipulating Characters. Manipulating Characters

ASCII Encoding. The char Type. Manipulating Characters. Manipulating Characters The char Type ASCII Encoding The C char type stores small integers. It is usually 8 bits. char variables guaranteed to be able to hold integers 0.. +127. char variables mostly used to store characters

More information

Java (12 Weeks) Introduction to Java Programming Language

Java (12 Weeks) Introduction to Java Programming Language Java (12 Weeks) Topic Lecture No. Introduction to Java Programming Language 1 An Introduction to Java o Java as a Programming Platform, The Java "White Paper" Buzzwords, Java and the Internet, A Short

More information

First Bytes Programming Lab 2

First Bytes Programming Lab 2 First Bytes Programming Lab 2 This lab is available online at www.cs.utexas.edu/users/scottm/firstbytes. Introduction: In this lab you will investigate the properties of colors and how they are displayed

More information

Lecture 22: C Programming 4 Embedded Systems

Lecture 22: C Programming 4 Embedded Systems Lecture 22: C Programming 4 Embedded Systems Today s Goals Basic C programming process Variables and constants in C Pointers to access addresses Using a High Level Language High-level languages More human

More information

About The Tutorial. Audience. Prerequisites. Copyright & Disclaimer

About The Tutorial. Audience. Prerequisites. Copyright & Disclaimer About The Tutorial C is a general-purpose, procedural, imperative computer programming language developed in 1972 by Dennis M. Ritchie at the Bell Telephone Laboratories to develop the UNIX operating system.

More information

ADVANCED SCHOOL OF SYSTEMS AND DATA STUDIES (ASSDAS) PROGRAM: CTech in Computer Science

ADVANCED SCHOOL OF SYSTEMS AND DATA STUDIES (ASSDAS) PROGRAM: CTech in Computer Science ADVANCED SCHOOL OF SYSTEMS AND DATA STUDIES (ASSDAS) PROGRAM: CTech in Computer Science Program Schedule CTech Computer Science Credits CS101 Computer Science I 3 MATH100 Foundations of Mathematics and

More information

Thomas Jefferson High School for Science and Technology Program of Studies Foundations of Computer Science. Unit of Study / Textbook Correlation

Thomas Jefferson High School for Science and Technology Program of Studies Foundations of Computer Science. Unit of Study / Textbook Correlation Thomas Jefferson High School for Science and Technology Program of Studies Foundations of Computer Science updated 03/08/2012 Unit 1: JKarel 8 weeks http://www.fcps.edu/is/pos/documents/hs/compsci.htm

More information

Embedded Programming in C/C++: Lesson-1: Programming Elements and Programming in C

Embedded Programming in C/C++: Lesson-1: Programming Elements and Programming in C Embedded Programming in C/C++: Lesson-1: Programming Elements and Programming in C 1 An essential part of any embedded system design Programming 2 Programming in Assembly or HLL Processor and memory-sensitive

More information

1 Abstract Data Types Information Hiding

1 Abstract Data Types Information Hiding 1 1 Abstract Data Types Information Hiding 1.1 Data Types Data types are an integral part of every programming language. ANSI-C has int, double and char to name just a few. Programmers are rarely content

More information

3 SOFTWARE AND PROGRAMMING LANGUAGES

3 SOFTWARE AND PROGRAMMING LANGUAGES 3 SOFTWARE AND PROGRAMMING LANGUAGES 3.1 INTRODUCTION In the previous lesson we discussed about the different parts and configurations of computer. It has been mentioned that programs or instructions have

More information

Domains and Competencies

Domains and Competencies Domains and Competencies DOMAIN I TECHNOLOGY APPLICATIONS CORE Standards Assessed: Computer Science 8 12 I VII Competency 001: The computer science teacher knows technology terminology and concepts; the

More information

Computer Programming I

Computer Programming I Computer Programming I COP 2210 Syllabus Spring Semester 2012 Instructor: Greg Shaw Office: ECS 313 (Engineering and Computer Science Bldg) Office Hours: Tuesday: 2:50 4:50, 7:45 8:30 Thursday: 2:50 4:50,

More information

Lecture 7: Programming for the Arduino

Lecture 7: Programming for the Arduino Lecture 7: Programming for the Arduino - The hardware - The programming environment - Binary world, from Assembler to C - - Programming C for the Arduino: more - Programming style Lect7-Page1 The hardware

More information

C PROGRAMMING FOR MATHEMATICAL COMPUTING

C PROGRAMMING FOR MATHEMATICAL COMPUTING UNIVERSITY OF CALICUT SCHOOL OF DISTANCE EDUCATION BSc MATHEMATICS (2011 Admission Onwards) VI Semester Elective Course C PROGRAMMING FOR MATHEMATICAL COMPUTING QUESTION BANK Multiple Choice Questions

More information

9 Control Statements. 9.1 Introduction. 9.2 Objectives. 9.3 Statements

9 Control Statements. 9.1 Introduction. 9.2 Objectives. 9.3 Statements 9 Control Statements 9.1 Introduction The normal flow of execution in a high level language is sequential, i.e., each statement is executed in the order of its appearance in the program. However, depending

More information

ML for the Working Programmer

ML for the Working Programmer ML for the Working Programmer 2nd edition Lawrence C. Paulson University of Cambridge CAMBRIDGE UNIVERSITY PRESS CONTENTS Preface to the Second Edition Preface xiii xv 1 Standard ML 1 Functional Programming

More information

PROG0101 Fundamentals of Programming PROG0101 FUNDAMENTALS OF PROGRAMMING. Chapter 3 Algorithms

PROG0101 Fundamentals of Programming PROG0101 FUNDAMENTALS OF PROGRAMMING. Chapter 3 Algorithms PROG0101 FUNDAMENTALS OF PROGRAMMING Chapter 3 1 Introduction to A sequence of instructions. A procedure or formula for solving a problem. It was created mathematician, Mohammed ibn-musa al-khwarizmi.

More information

vii TABLE OF CONTENTS CHAPTER TITLE PAGE DECLARATION DEDICATION ACKNOWLEDGEMENT ABSTRACT ABSTRAK

vii TABLE OF CONTENTS CHAPTER TITLE PAGE DECLARATION DEDICATION ACKNOWLEDGEMENT ABSTRACT ABSTRAK vii TABLE OF CONTENTS CHAPTER TITLE PAGE DECLARATION DEDICATION ACKNOWLEDGEMENT ABSTRACT ABSTRAK TABLE OF CONTENTS LIST OF TABLES LIST OF FIGURES LIST OF ABBREVIATIONS LIST OF SYMBOLS LIST OF APPENDICES

More information

C++ INTERVIEW QUESTIONS

C++ INTERVIEW QUESTIONS C++ INTERVIEW QUESTIONS http://www.tutorialspoint.com/cplusplus/cpp_interview_questions.htm Copyright tutorialspoint.com Dear readers, these C++ Interview Questions have been designed specially to get

More information

From The Little SAS Book, Fifth Edition. Full book available for purchase here.

From The Little SAS Book, Fifth Edition. Full book available for purchase here. From The Little SAS Book, Fifth Edition. Full book available for purchase here. Acknowledgments ix Introducing SAS Software About This Book xi What s New xiv x Chapter 1 Getting Started Using SAS Software

More information

AP Computer Science Java Subset

AP Computer Science Java Subset APPENDIX A AP Computer Science Java Subset The AP Java subset is intended to outline the features of Java that may appear on the AP Computer Science A Exam. The AP Java subset is NOT intended as an overall

More information

5 Arrays and Pointers

5 Arrays and Pointers 5 Arrays and Pointers 5.1 One-dimensional arrays Arrays offer a convenient way to store and access blocks of data. Think of arrays as a sequential list that offers indexed access. For example, a list of

More information

Programming Microcontrollers in C

Programming Microcontrollers in C Programming Microcontrollers in C Second Edition Ted Van Sickle A Volume in the EMBEDDED TECHNOLOGY TM Series Eagle Rock, Virginia www.llh-publishing.com Programming Microcontrollers in C 2001 by LLH Technology

More information

Bangalore University B.Sc Computer Science Syllabus ( Semester System)

Bangalore University B.Sc Computer Science Syllabus ( Semester System) Bangalore University B.Sc Computer Science Syllabus ( Semester System) First Semester CSIT1: Computer Fundamentals and C Programming CSIP1: C Programming Lab Second Semester CSIIT1: Data Structures and

More information

Computer Programming I & II*

Computer Programming I & II* Computer Programming I & II* Career Cluster Information Technology Course Code 10152 Prerequisite(s) Computer Applications, Introduction to Information Technology Careers (recommended), Computer Hardware

More information

C++ Language Tutorial

C++ Language Tutorial cplusplus.com C++ Language Tutorial Written by: Juan Soulié Last revision: June, 2007 Available online at: http://www.cplusplus.com/doc/tutorial/ The online version is constantly revised and may contain

More information

Keil C51 Cross Compiler

Keil C51 Cross Compiler Keil C51 Cross Compiler ANSI C Compiler Generates fast compact code for the 8051 and it s derivatives Advantages of C over Assembler Do not need to know the microcontroller instruction set Register allocation

More information

SECTION C [short essay] [Not to exceed 120 words, Answer any SIX questions. Each question carries FOUR marks] 6 x 4=24 marks

SECTION C [short essay] [Not to exceed 120 words, Answer any SIX questions. Each question carries FOUR marks] 6 x 4=24 marks UNIVERSITY OF KERALA First Degree Programme in Computer Applications Model Question Paper Semester I Course Code- CP 1121 Introduction to Computer Science TIME : 3 hrs Maximum Mark: 80 SECTION A [Very

More information

TABLE OF CONTENT CHAPTER TITLE PAGE TITLE DECLARATION DEDICATION ACKNOWLEDGEMENTS ABSTRACT ABSTRAK

TABLE OF CONTENT CHAPTER TITLE PAGE TITLE DECLARATION DEDICATION ACKNOWLEDGEMENTS ABSTRACT ABSTRAK TABLE OF CONTENT CHAPTER TITLE PAGE TITLE DECLARATION DEDICATION ACKNOWLEDGEMENTS ABSTRACT ABSTRAK TABLE OF CONTENT LIST OF TABLES LIST OF FIGURES LIST OF ABBREVIATIONS LIST OF APPENDICES i ii iii iv v

More information

Boolean Expressions, Conditions, Loops, and Enumerations. Precedence Rules (from highest to lowest priority)

Boolean Expressions, Conditions, Loops, and Enumerations. Precedence Rules (from highest to lowest priority) Boolean Expressions, Conditions, Loops, and Enumerations Relational Operators == // true if two values are equivalent!= // true if two values are not equivalent < // true if left value is less than the

More information

ALLIED PAPER : DISCRETE MATHEMATICS (for B.Sc. Computer Technology & B.Sc. Multimedia and Web Technology)

ALLIED PAPER : DISCRETE MATHEMATICS (for B.Sc. Computer Technology & B.Sc. Multimedia and Web Technology) ALLIED PAPER : DISCRETE MATHEMATICS (for B.Sc. Computer Technology & B.Sc. Multimedia and Web Technology) Subject Description: This subject deals with discrete structures like set theory, mathematical

More information

Chapter 4: Computer Codes

Chapter 4: Computer Codes Slide 1/30 Learning Objectives In this chapter you will learn about: Computer data Computer codes: representation of data in binary Most commonly used computer codes Collating sequence 36 Slide 2/30 Data

More information

Basic Programming and PC Skills: Basic Programming and PC Skills:

Basic Programming and PC Skills: Basic Programming and PC Skills: Texas University Interscholastic League Contest Event: Computer Science The contest challenges high school students to gain an understanding of the significance of computation as well as the details of

More information

Objective-C Tutorial

Objective-C Tutorial Objective-C Tutorial OBJECTIVE-C TUTORIAL Simply Easy Learning by tutorialspoint.com tutorialspoint.com i ABOUT THE TUTORIAL Objective-c tutorial Objective-C is a general-purpose, object-oriented programming

More information

Microsoft' Excel & Access Integration

Microsoft' Excel & Access Integration Microsoft' Excel & Access Integration with Office 2007 Michael Alexander and Geoffrey Clark J1807 ; pwiueyb Wiley Publishing, Inc. Contents About the Authors Acknowledgments Introduction Part I: Basic

More information

Introduction to Windchill Projectlink 10.2

Introduction to Windchill Projectlink 10.2 Introduction to Windchill Projectlink 10.2 Overview Course Code Course Length TRN-4270 1 Day In this course, you will learn how to participate in and manage projects using Windchill ProjectLink 10.2. Emphasis

More information

Chapter 1. Dr. Chris Irwin Davis Email: cid021000@utdallas.edu Phone: (972) 883-3574 Office: ECSS 4.705. CS-4337 Organization of Programming Languages

Chapter 1. Dr. Chris Irwin Davis Email: cid021000@utdallas.edu Phone: (972) 883-3574 Office: ECSS 4.705. CS-4337 Organization of Programming Languages Chapter 1 CS-4337 Organization of Programming Languages Dr. Chris Irwin Davis Email: cid021000@utdallas.edu Phone: (972) 883-3574 Office: ECSS 4.705 Chapter 1 Topics Reasons for Studying Concepts of Programming

More information

PES Institute of Technology-BSC QUESTION BANK

PES Institute of Technology-BSC QUESTION BANK PES Institute of Technology-BSC Faculty: Mrs. R.Bharathi CS35: Data Structures Using C QUESTION BANK UNIT I -BASIC CONCEPTS 1. What is an ADT? Briefly explain the categories that classify the functions

More information

Beginning C# 5.0. Databases. Vidya Vrat Agarwal. Second Edition

Beginning C# 5.0. Databases. Vidya Vrat Agarwal. Second Edition Beginning C# 5.0 Databases Second Edition Vidya Vrat Agarwal Contents J About the Author About the Technical Reviewer Acknowledgments Introduction xviii xix xx xxi Part I: Understanding Tools and Fundamentals

More information

Topics. Introduction. Java History CS 146. Introduction to Programming and Algorithms Module 1. Module Objectives

Topics. Introduction. Java History CS 146. Introduction to Programming and Algorithms Module 1. Module Objectives Introduction to Programming and Algorithms Module 1 CS 146 Sam Houston State University Dr. Tim McGuire Module Objectives To understand: the necessity of programming, differences between hardware and software,

More information

Outline. hardware components programming environments. installing Python executing Python code. decimal and binary notations running Sage

Outline. hardware components programming environments. installing Python executing Python code. decimal and binary notations running Sage Outline 1 Computer Architecture hardware components programming environments 2 Getting Started with Python installing Python executing Python code 3 Number Systems decimal and binary notations running

More information

Instruction Set Architecture (ISA)

Instruction Set Architecture (ISA) Instruction Set Architecture (ISA) * Instruction set architecture of a machine fills the semantic gap between the user and the machine. * ISA serves as the starting point for the design of a new machine

More information

Language Evaluation Criteria. Evaluation Criteria: Readability. Evaluation Criteria: Writability. ICOM 4036 Programming Languages

Language Evaluation Criteria. Evaluation Criteria: Readability. Evaluation Criteria: Writability. ICOM 4036 Programming Languages ICOM 4036 Programming Languages Preliminaries Dr. Amirhossein Chinaei Dept. of Electrical & Computer Engineering UPRM Spring 2010 Language Evaluation Criteria Readability: the ease with which programs

More information

1 Classical Universal Computer 3

1 Classical Universal Computer 3 Chapter 6: Machine Language and Assembler Christian Jacob 1 Classical Universal Computer 3 1.1 Von Neumann Architecture 3 1.2 CPU and RAM 5 1.3 Arithmetic Logical Unit (ALU) 6 1.4 Arithmetic Logical Unit

More information

DNA Data and Program Representation. Alexandre David 1.2.05 adavid@cs.aau.dk

DNA Data and Program Representation. Alexandre David 1.2.05 adavid@cs.aau.dk DNA Data and Program Representation Alexandre David 1.2.05 adavid@cs.aau.dk Introduction Very important to understand how data is represented. operations limits precision Digital logic built on 2-valued

More information

Chapter 13 Storage classes

Chapter 13 Storage classes Chapter 13 Storage classes 1. Storage classes 2. Storage Class auto 3. Storage Class extern 4. Storage Class static 5. Storage Class register 6. Global and Local Variables 7. Nested Blocks with the Same

More information

Programming and Software Development CTAG Alignments

Programming and Software Development CTAG Alignments Programming and Software Development CTAG Alignments This document contains information about four Career-Technical Articulation Numbers (CTANs) for Programming and Software Development Career-Technical

More information

SQL Server. 2012 for developers. murach's TRAINING & REFERENCE. Bryan Syverson. Mike Murach & Associates, Inc. Joel Murach

SQL Server. 2012 for developers. murach's TRAINING & REFERENCE. Bryan Syverson. Mike Murach & Associates, Inc. Joel Murach TRAINING & REFERENCE murach's SQL Server 2012 for developers Bryan Syverson Joel Murach Mike Murach & Associates, Inc. 4340 N. Knoll Ave. Fresno, CA 93722 www.murach.com murachbooks@murach.com Expanded

More information

arrays C Programming Language - Arrays

arrays C Programming Language - Arrays arrays So far, we have been using only scalar variables scalar meaning a variable with a single value But many things require a set of related values coordinates or vectors require 3 (or 2, or 4, or more)

More information

C# Cookbook. Stephen Teilhet andjay Hilyard. O'REILLY 8 Beijing Cambridge Farnham Köln Paris Sebastopol Taipei Tokyo '"J""'

C# Cookbook. Stephen Teilhet andjay Hilyard. O'REILLY 8 Beijing Cambridge Farnham Köln Paris Sebastopol Taipei Tokyo 'J' C# Cookbook '"J""' Stephen Teilhet andjay Hilyard O'REILLY 8 Beijing Cambridge Farnham Köln Paris Sebastopol Taipei Tokyo Tableof Contents Preface xv 1. Numbers 1 1.1 Determining Approximate Equality Between

More information

KS3 Computing Group 1 Programme of Study 2015 2016 2 hours per week

KS3 Computing Group 1 Programme of Study 2015 2016 2 hours per week 1 07/09/15 2 14/09/15 3 21/09/15 4 28/09/15 Communication and Networks esafety Obtains content from the World Wide Web using a web browser. Understands the importance of communicating safely and respectfully

More information

Lexical Analysis and Scanning. Honors Compilers Feb 5 th 2001 Robert Dewar

Lexical Analysis and Scanning. Honors Compilers Feb 5 th 2001 Robert Dewar Lexical Analysis and Scanning Honors Compilers Feb 5 th 2001 Robert Dewar The Input Read string input Might be sequence of characters (Unix) Might be sequence of lines (VMS) Character set ASCII ISO Latin-1

More information

Hi iv. Declaration Certificate Acknowledgement Preface. List o f Table. List o f Figures. viii xvi xvii. 1.1 Introduction 1

Hi iv. Declaration Certificate Acknowledgement Preface. List o f Table. List o f Figures. viii xvi xvii. 1.1 Introduction 1 Declaration Certificate Acknowledgement Preface. List o f Table. List o f Figures Hi iv V viii xvi xvii Chapter 1 Introduction 1-13 1.1 Introduction 1 1.2 Statement of the Problem 3 1.2.1 Terms used in

More information

Contents. 1 Introduction. 2 Feature List. 3 Feature Interaction Matrix. 4 Feature Interactions

Contents. 1 Introduction. 2 Feature List. 3 Feature Interaction Matrix. 4 Feature Interactions 1 Introduction 1.1 Purpose and Scope................................. 1 1 1.2 Organization..................................... 1 2 1.3 Requirements Notation............................... 1 2 1.4 Requirements

More information

DIGITAL MARKETING PROPOSAL. Stage 1: SEO Audit/Correction. www.abccompany.com

DIGITAL MARKETING PROPOSAL. Stage 1: SEO Audit/Correction. www.abccompany.com DIGITAL MARKETING PROPOSAL www.abccompany.com SEARCH ENGINE OPTIMIZATION SEO Search Engine Optimization SEO (search engine optimization) is the process of improving the visibility of a website or a web

More information