C Programming. in One Hour a Day. Seventh Edition. Sa ms Teach Yourself. Bradley L. Jones. Peter Aitken. Dean Miller

Size: px
Start display at page:

Download "C Programming. in One Hour a Day. Seventh Edition. Sa ms Teach Yourself. Bradley L. Jones. Peter Aitken. Dean Miller"

Transcription

1 Bradley L Jones Peter Aitken Dean Miller Sa ms Teach Yourself C Programming in One Hour a Day Seventh Edition 800 East 96th Street, Indianapolis, Indiana 46240

2 Table of Contents Introduction part I: Fundamentals of C LESSON l: Getting Started with C 5 A Brief History of the C Language 6 Why Use C? 6 Preparing to Program 8 The Program Development Cycle 8 Creating the Source Code 9 Compiling the Source Code 9 Linking to Create an Executable File 10 Completing the Development Cycle 11 Your First C Program 13 Entering and Compiling helloc 14 Summary 18 Q&A 18 Workshop 19 Quiz 19 Exercises 20 lesson 2: The Components of a C Program 23 A Short C Program 24 The Program's Components 25 The main () Function (Lines 9 Through 23) 25 The ((include and #define Directives (Lines 2 and 3) 25 The Variable Definition (Line 5) 26 The Function Prototype (Line 7) 26 Program Statements (Lines 12 13, and 28) 26 The Function Definition (Lines 26 Through 29) 27 Program Comments (Lines 1 II 16 and 25) 27 Using Braces (Lines 10, 23, 27 and 29) 29 Running the Program 29 A Note on Accuracy 29

3 Contents i v A Review of the Parts of a Program 30 Summary 32 Q&A 33 Workshop 33 Quiz 33 Exercises 34 lesson 3: Storing Information: Variables and Constants 37 Understanding Your Computer's Memory 38 Storing Information with Variables 39 Variable Names 39 Numeric Variable Types 40 Variable Declarations 44 The typedef Keyword 45 Initializing Variables 45 Constants 47 Literal Constants 47 Symbolic Constants 48 Summary 53 Q&A 53 Workshop 54 Quiz 54 Exercises 55 lesson 4: The Pieces of a C Program: Statements, Expressions, and Operators 57 Statements 58 The Impact of White Space on Statements 58 Creating a Null Statement 59 Working with Compound Statements 59 Understanding Expressions 60 Simple Expressions 60 Complex Expressions 60 Operators 61 The Assignment Operator 62 The Mathematical Operators 62 Operator Precedence and Parentheses 67

4 vi Sams Teach Yourself C Programming in One Hour a Day Order of Subexpression Evaluation 69 The Relational Operators 70 The if Statement 71 The else Clause 74 Evaluating Relational Expressions 77 The Precedence of Relational Operators 79 The Logical Operators 80 More on True/False Values 82 The Precedence of Operators 82 Compound Assignment Operators 84 The Conditional Operator 85 The Comma Operator 85 Operator Precedence Revisited 86 Summary 87 Q&A 88 Workshop 88 Quiz 89 Exercises 89 LESSON 5: Packaging Code in Functions 91 Understanding Functions 92 A Function Defined 92 A Function Illustrated 92 How a Function Works 95 Functions and Structured Programming 97 The Advantages of Structured Programming 97 Planning a Structured Program 97 The Top-Down Approach 99 Writing a Function 100 The Function Header 100 The Function Body 103 The Function Prototype 109 Passing Arguments to a Function 110 Calling Functions 110 Recursion 1 \ 2 Where the Functions Belong 114

5 while Contents j vii Working with Inline Functions 115 Summary 115 Q&A 116 Workshop 116 Quiz 116 Exercises 117 LESSON 6: Basic Program Control 119 Arrays: The Basics 120 Controlling Program Execution 121 The for Statement 121 Nesting for Statements 127 The while Statement 130 Nesting while Statements 134 The do Loop 136 Nested Loops 141 Summary 142 Q&A 142 Workshop 143 Quiz 143 Exercises 143 lesson 7: Fundamentals of Reading and Writing Information 145 Displaying Information Onscreen 146 TheprintfO Function 146 TheprintfO Format Strings 146 Displaying Messages with puts () 155 Inputting Numeric Data with scanf () Using Trigraph Sequences 161 Summary 162 Q&A Workshop 163 Quiz 163 Exercises 164

6 viii Sams Teach Yourself C Programming in One Hour a Day part II: Putting C to Work LESSON 8: Using Numeric Arrays 167 What Is an Array? 168 Using Single-Dimensional Arrays 169 Using Multidimensional Arrays 173 Naming and Declaring Arrays 174 Initializing Arrays 178 Initializing Multidimensional Arrays 179 Summary 182 Q&A 183 Workshop 184 Quiz 184 Exercises 184 LESSON 9: Understanding Pointers 187 What Is a Pointer? 188 Your Computer's Memory 188 Creating a Pointer 188 Pointers and Simple Variables 189 Declaring Pointers 189 Initializing Pointers 190 Using Pointers 190 Pointers and Variable Types 193 Pointers and Arrays 194 The Array Name as a Pointer 194 Array Element Storage 195 Pointer Arithmetic 198 Pointer Cautions 202 Array Subscript Notation and Pointers 203 Passing Arrays to Functions 204 Summary 209 Q&A 210 Workshop 210 Quiz 210 Exercises 211

7 Contents j ix LESSON 10: Working with Characters and Strings 213 The char Data Type 214 Using Character Variables 215 Using Strings 218 Arrays of Characters 218 Initializing Character Arrays 219 Strings and Pointers 219 Strings Without Arrays 220 Allocating String Space at Compilation 220 The malloc () Function 221 Using the malloc () Function 222 Displaying Strings and Characters 226 The puts () Function 226 Theprintf () Function 227 Reading Strings from the Keyboard 228 Inputting Strings Using the gets () Function 228 Inputting Strings Using the scanf () Function 232 Summary 235 Q&A 235 Workshop 237 Quiz 237 Exercises 238 lesson 11: Implementing Structures, Unions, and TypeDefs 241 Working with Simple Structures 242 Defining and Declaring Structures 242 Accessing Members of a Structure 243 Using Structures That Are More Complex 246 Including Structures Within Other Structures 246 Structures That Contain Arrays 250 Arrays of Structures 252 Initializing Structures 256 Structures and Pointers 259 Including Pointers as Structure Members 259 Creating Pointers to Structures 261 Working with Pointers and Arrays of Structures 264 Passing Structures as Arguments to Functions 267

8 X Sams Teach Yourself C Programming in One Hour a Day Understanding Unions 268 Defining Declaring, and Initializing Unions 269 Accessing Union Members 269 Creating Synonyms for Structures with typedef 274 Summary 275 Q&A 275 Workshop 276 Quiz 276 Exercises 277 LESSON 12: Understanding Variable Scope 279 What Is Scope? 280 A Demonstration of Scope 280 The Importance of Scope 282 Creating External Variables 282 External Variable Scope 283 When to Use External Variables 283 The extern Keyword 283 Creating Local Variables 285 Static Versus Automatic Variables 285 The Scope of Function Parameters 288 External Static Variables 289 Register Variables 289 Local Variables and the main () Function 290 Which Storage Class Should You Use? 291 Local Variables and Blocks Summary Q&A Workshop Quiz Exercises LESSON 13: Advanced Program Control Ending Loops Early The break Statement The continue Statement 299 ^qq 3qq ^02

9 Contents xi The goto Statement 304 Infinite Loops 307 The switch Statement 311 Exiting the Program 320 The exit () Function 320 Summary 321 Q&A 321 Workshop 322 Quiz 322 Exercises 322 lesson 14: Working with the Screen, Printer, and Keyboard 325 Streams and C 326 What Exactly Is Program Input/Output'' 326 What Is a Stream Text Versus Binary Streams 327 Predefined Streams 327 Using C's Stream Functions 328 An Example 329 Accepting Keyboard Input 329 Character Input 330 Working with Formatted Input 338 Controlling Output to the Screen 347 Character Output with putchar (), putc (), and fputc () 347 Using puts 0 and fputs 0 for String Output 349 Using printf () andfprintfo for Formatted Output 350 When to Use fprintf () 357 Using stderr 357 Summary 358 Q&A 359 Workshop 359 Quiz 359 Exercises 360

10 xii Sams Teach Yourself C Programming in One Hour a Day part ill: Advanced C 383 LESSON 15: Pointers to Pointers and Arrays of Pointers 361 Declaring Pointers to Pointers 362 Pointers and Multidimensional Arrays 363 Working with Arrays of Pointers 372 Strings and Pointers: A Review 372 Declaring an Array of Pointers to Type char 373 Pulling Things Together with an Example 375 Summary 381 Q&A 382 Workshop 382 Quiz 382 Exercises LESSON 16: Pointers to Functions and Linked Lists 385 Working with Pointers to Functions 386 Declaring a Pointer to a Function 386 Initializing and Using a Pointer to a Function 387 Understanding Linked Lists 396 Basics of Linked Lists 396 Working with Linked Lists 398 A Simple Linked List Demonstration 403 Implementing a Linked List 406 Summary 415 Q&A 415 Workshop 415 Quiz 415 Exercises 416 LESSON 17: Using Disk Files 417 Relating Streams to Disk Files 418 Understanding the Types of Disk Files 418 Using Filenames 41 g Opening a File 419

11 j Contents xiii Writing and Reading File Data 423 Formatted File Input and Output 424 Character Input and Output 428 Direct File Input and Output 431 File Buffering: Closing and Flushing Files 435 Understanding Sequential Versus Random File Access 436 The f tell () andrewindo Functions 437 The f seek () Function 440 Detecting the End of a File 443 File Management Functions 445 Deleting a File 445 a Renaming File 446 Copying a File 447 Using Temporary Files 450 Summary 452 Q&A 452 Workshop 453 Quiz 453 Exercises 454 LESSON 18: Manipulating Strings 455 Determining String Length 456 Copying Strings 457 ThestrcpyO Function 457 The strncpyo Function 459 Concatenating Strings 461 Using the strcat () Function 461 Using the strncat () Function 462 Comparing Strings 464 Comparing Two Entire Strings 464 Comparing Partial Strings 466 Searching Strings 468 ThestrchrO Function 468 The strrchr () Function 470 The strcspn () Function 470 ThestrspnO Function 471

12 xiv Sams Teach Yourself C Programming in One Hour a Day The strpbrko Function 473 The strstro Function 473 String-to-Number Conversions 474 Converting Strings to Integers 475 Converting Strings to Longs 475 Converting Strings to Long Longs 476 Converting Strings to Floating-Point Numeric Values 476 Character-Test Functions 477 ANSI Support for Uppercase and Lowercase 481 Summary 483 Q&A 483 Workshop 484 Quiz 484 Exercises 484 lesson 19: Getting More from Functions 487 Passing Pointers to Functions 488 Type void Pointers 492 Using Functions That Have a Variable Number of Arguments 496 Functions That Return a Pointer 499 Summary 501 Q&A 502 Workshop 502 Quiz 502 Exercises 503 LESSON 20: Exploring the C Function Library 505 Mathematical Functions 506 Trigonometric Functions 506 Exponential and Logarithmic Functions 506 Hyperbolic Functions 507 Other Mathematical Functions 507 A Demonstration of the Math Functions 508 Dealing with Time 509 Representing Time 509 The Time Functions 510 Using the Time Functions 513

13 Contents xv Error-Handling 516 The assert () Macro 516 The errno h Header File TheperrorO Function 519 Searching and Sorting 521 Searching with bsearch () 521 Sorting with qsort () 523 Searching and Sorting: Two Demonstrations 523 Summary 529 Q&A 529 Workshop Quiz 530 Exercises 531 LESSON 21: Working with Memory 533 Type Conversions 534 Automatic Type Conversions 534 Explicit Conversions Using Typecasts 536 Allocating Memory Storage Space 538 Allocating Memory with the malloc () Function 539 Allocating Memory with the calloc () Function 540 Allocating More Memory with the realloc () Function 541 Releasing Memory with the free () Function 543 Manipulating Memory Blocks 545 Initializing Memory with the memset () Function 545 Copying Memory with the memcpy () Function 546 Moving Memory with the memmove () Function 546 Working with Bits 548 The Shift Operators 548 The Bitwise Logical Operators 550 The Complement Operator 552 Bit Fields in Structures 552 Summary 554 Q&A 554 Workshop 556 Quiz 556 Exercises 557

14 xvi Sams Teach Yourself C Programming in One Hour a Day lesson 22: Advanced Compiler Use 559 Programming with Multiple Source-Code Files 560 Advantages of Modular Programming 560 Modular Programming Techniques 560 Module Components 564 External Variables and Modular Programming 565 The C Preprocessor 567 The #def ine Preprocessor Directive 567 Using the #inciude Directive 572 Using Using #if ttif #elif tfelse, and tfendif 573 #endif to Help Debug 574 Avoiding Multiple Inclusions of Header Files 575 The tfundef Directive 576 Predefined Macros 576 Using Command-Line Arguments 577 Summary 580 Q&A 580 Workshop 581 Quiz 581 Exercises 582 part 4: Appendixes APPENDIX A: ASCII Chart 583 APPENDIX B: C/C++ Reserved Words 589 APPENDIX C: Common C Functions 593 appendix D: Answers 599 Index 645

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

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

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

GUJARAT TECHNOLOGICAL UNIVERSITY, AHMEDABAD, GUJARAT COURSE CURRICULUM. Course Title: Advanced Computer Programming (Code: 3320702)

GUJARAT TECHNOLOGICAL UNIVERSITY, AHMEDABAD, GUJARAT COURSE CURRICULUM. Course Title: Advanced Computer Programming (Code: 3320702) GUJARAT TECHNOLOGICAL UNIVERSITY, AHMEDABAD, GUJARAT COURSE CURRICULUM Course Title: Advanced Computer Programming (Code: 3320702) Diploma Programmes in which this course is offered Computer Engineering,

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

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

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

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

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

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

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

Illustration 1: Diagram of program function and data flow

Illustration 1: Diagram of program function and data flow The contract called for creation of a random access database of plumbing shops within the near perimeter of FIU Engineering school. The database features a rating number from 1-10 to offer a guideline

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

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

Chapter 13 - The Preprocessor

Chapter 13 - The Preprocessor Chapter 13 - The Preprocessor Outline 13.1 Introduction 13.2 The#include Preprocessor Directive 13.3 The#define Preprocessor Directive: Symbolic Constants 13.4 The#define Preprocessor Directive: Macros

More information

Moving from CS 61A Scheme to CS 61B Java

Moving from CS 61A Scheme to CS 61B Java Moving from CS 61A Scheme to CS 61B Java Introduction Java is an object-oriented language. This document describes some of the differences between object-oriented programming in Scheme (which we hope you

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

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

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

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

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

C Interview Questions

C Interview Questions http://techpreparation.com C Interview Questions And Answers 2008 V i s i t T e c h P r e p a r a t i o n. c o m f o r m o r e i n t e r v i e w q u e s t i o n s a n d a n s w e r s C Interview Questions

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

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

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

Module 816. File Management in C. M. Campbell 1993 Deakin University

Module 816. File Management in C. M. Campbell 1993 Deakin University M. Campbell 1993 Deakin University Aim Learning objectives Content After working through this module you should be able to create C programs that create an use both text and binary files. After working

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

Curriculum Map. Discipline: Computer Science Course: C++

Curriculum Map. Discipline: Computer Science Course: C++ Curriculum Map Discipline: Computer Science Course: C++ August/September: How can computer programs make problem solving easier and more efficient? In what order does a computer execute the lines of code

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

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

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

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

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

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

Oracle Database: SQL and PL/SQL Fundamentals

Oracle Database: SQL and PL/SQL Fundamentals Oracle University Contact Us: +966 12 739 894 Oracle Database: SQL and PL/SQL Fundamentals Duration: 5 Days What you will learn This Oracle Database: SQL and PL/SQL Fundamentals training is designed to

More information

MISRA-C:2012 Standards Model Summary for C / C++

MISRA-C:2012 Standards Model Summary for C / C++ MISRA-C:2012 Standards Model Summary for C / C++ The LDRA tool suite is developed and certified to BS EN ISO 9001:2000. This information is applicable to version 9.4.2 of the LDRA tool suite. It is correct

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

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

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

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

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

Object Oriented Software Design

Object Oriented Software Design Object Oriented Software Design Introduction to Java - II Giuseppe Lipari http://retis.sssup.it/~lipari Scuola Superiore Sant Anna Pisa October 28, 2010 G. Lipari (Scuola Superiore Sant Anna) Introduction

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

Course Name: ADVANCE COURSE IN SOFTWARE DEVELOPMENT (Specialization:.Net Technologies)

Course Name: ADVANCE COURSE IN SOFTWARE DEVELOPMENT (Specialization:.Net Technologies) Course Name: ADVANCE COURSE IN SOFTWARE DEVELOPMENT (Specialization:.Net Technologies) Duration of Course: 6 Months Fees: Rs. 25,000/- (including Service Tax) Eligibility: B.E./B.Tech., M.Sc.(IT/ computer

More information

Oracle Database 12c: Introduction to SQL Ed 1.1

Oracle Database 12c: Introduction to SQL Ed 1.1 Oracle University Contact Us: 1.800.529.0165 Oracle Database 12c: Introduction to SQL Ed 1.1 Duration: 5 Days What you will learn This Oracle Database: Introduction to SQL training helps you write subqueries,

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

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

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

Storage Classes CS 110B - Rule Storage Classes Page 18-1 \handouts\storclas

Storage Classes CS 110B - Rule Storage Classes Page 18-1 \handouts\storclas CS 110B - Rule Storage Classes Page 18-1 Attributes are distinctive features of a variable. Data type, int or double for example, is an attribute. Storage class is another attribute. There are four storage

More information

Object Oriented Software Design

Object Oriented Software Design Object Oriented Software Design Introduction to Java - II Giuseppe Lipari http://retis.sssup.it/~lipari Scuola Superiore Sant Anna Pisa September 14, 2011 G. Lipari (Scuola Superiore Sant Anna) Introduction

More information

MULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question.

MULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question. Exam Name MULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question. 1) The JDK command to compile a class in the file Test.java is A) java Test.java B) java

More information

File Handling. What is a file?

File Handling. What is a file? File Handling 1 What is a file? A named collection of data, stored in secondary storage (typically). Typical operations on files: Open Read Write Close How is a file stored? Stored as sequence of bytes,

More information

Oracle Database: SQL and PL/SQL Fundamentals

Oracle Database: SQL and PL/SQL Fundamentals Oracle University Contact Us: 1.800.529.0165 Oracle Database: SQL and PL/SQL Fundamentals Duration: 5 Days What you will learn This course is designed to deliver the fundamentals of SQL and PL/SQL along

More information

Computing Concepts with Java Essentials

Computing Concepts with Java Essentials 2008 AGI-Information Management Consultants May be used for personal purporses only or by libraries associated to dandelon.com network. Computing Concepts with Java Essentials 3rd Edition Cay Horstmann

More information

Glossary of Object Oriented Terms

Glossary of Object Oriented Terms Appendix E Glossary of Object Oriented Terms abstract class: A class primarily intended to define an instance, but can not be instantiated without additional methods. abstract data type: An abstraction

More information

Oracle Database: SQL and PL/SQL Fundamentals NEW

Oracle Database: SQL and PL/SQL Fundamentals NEW Oracle University Contact Us: + 38516306373 Oracle Database: SQL and PL/SQL Fundamentals NEW Duration: 5 Days What you will learn This Oracle Database: SQL and PL/SQL Fundamentals training delivers the

More information

Windows PowerShell Cookbook

Windows PowerShell Cookbook Windows PowerShell Cookbook Lee Holmes O'REILLY' Beijing Cambridge Farnham Koln Paris Sebastopol Taipei Tokyo Table of Contents Foreword Preface xvii xxi Part I. Tour A Guided Tour of Windows PowerShell

More information

As previously noted, a byte can contain a numeric value in the range 0-255. Computers don't understand Latin, Cyrillic, Hindi, Arabic character sets!

As previously noted, a byte can contain a numeric value in the range 0-255. Computers don't understand Latin, Cyrillic, Hindi, Arabic character sets! Encoding of alphanumeric and special characters As previously noted, a byte can contain a numeric value in the range 0-255. Computers don't understand Latin, Cyrillic, Hindi, Arabic character sets! Alphanumeric

More information

Topics. Parts of a Java Program. Topics (2) CS 146. Introduction To Computers And Java Chapter Objectives To understand:

Topics. Parts of a Java Program. Topics (2) CS 146. Introduction To Computers And Java Chapter Objectives To understand: Introduction to Programming and Algorithms Module 2 CS 146 Sam Houston State University Dr. Tim McGuire Introduction To Computers And Java Chapter Objectives To understand: the meaning and placement of

More information

20 Using Scripts. (Programming without Parts) 20-1

20 Using Scripts. (Programming without Parts) 20-1 20 Using Scripts (Programming without Parts) This chapter explains the basics of creating and using programming scripts in GP-Pro EX. Please start by reading 20.1 Settings Menu (page 20-2) and then turn

More information

First Java Programs. V. Paúl Pauca. CSC 111D Fall, 2015. Department of Computer Science Wake Forest University. Introduction to Computer Science

First Java Programs. V. Paúl Pauca. CSC 111D Fall, 2015. Department of Computer Science Wake Forest University. Introduction to Computer Science First Java Programs V. Paúl Pauca Department of Computer Science Wake Forest University CSC 111D Fall, 2015 Hello World revisited / 8/23/15 The f i r s t o b l i g a t o r y Java program @author Paul Pauca

More information

1) The postfix expression for the infix expression A+B*(C+D)/F+D*E is ABCD+*F/DE*++

1) The postfix expression for the infix expression A+B*(C+D)/F+D*E is ABCD+*F/DE*++ Answer the following 1) The postfix expression for the infix expression A+B*(C+D)/F+D*E is ABCD+*F/DE*++ 2) Which data structure is needed to convert infix notations to postfix notations? Stack 3) The

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

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

Memory management. Announcements. Safe user input. Function pointers. Uses of function pointers. Function pointer example

Memory management. Announcements. Safe user input. Function pointers. Uses of function pointers. Function pointer example Announcements Memory management Assignment 2 posted, due Friday Do two of the three problems Assignment 1 graded see grades on CMS Lecture 7 CS 113 Spring 2008 2 Safe user input If you use scanf(), include

More information

The System Designer's Guide to VHDL-AMS

The System Designer's Guide to VHDL-AMS The System Designer's Guide to VHDL-AMS Analog, Mixed-Signal, and Mixed-Technology Modeling Peter J. Ashenden EDA CONSULTANT, ASHENDEN DESIGNS PTY. LTD. VISITING RESEARCH FELLOW, ADELAIDE UNIVERSITY Gregory

More information

A C Test: The 0x10 Best Questions for Would-be Embedded Programmers

A C Test: The 0x10 Best Questions for Would-be Embedded Programmers A C Test: The 0x10 Best Questions for Would-be Embedded Programmers Nigel Jones Pencils up, everyone. Here s a test to identify potential embedded programmers or embedded programmers with potential An

More information

BCS2B02: OOP Concepts and Data Structures Using C++

BCS2B02: OOP Concepts and Data Structures Using C++ SECOND SEMESTER BCS2B02: OOP Concepts and Data Structures Using C++ Course Number: 10 Contact Hours per Week: 4 (2T + 2P) Number of Credits: 2 Number of Contact Hours: 30 Hrs. Course Evaluation: Internal

More information

Efficient representation of integer sets

Efficient representation of integer sets Efficient representation of integer sets Marco Almeida Rogério Reis Technical Report Series: DCC-2006-06 Version 1.0 Departamento de Ciência de Computadores & Laboratório de Inteligência Artificial e Ciência

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

Syllabus for Computer Science. Proposed scheme for B.Sc Programme under Choice Based Credit System

Syllabus for Computer Science. Proposed scheme for B.Sc Programme under Choice Based Credit System Syllabus for Computer Science Proposed scheme for B.Sc Programme under Choice Based Credit System SEMESTER - I Code Course Title Course Type HPW Credits BS106 SEMESTER -I I BS 206 SEMESTER -III BS 301

More information

Object Oriented Software Design II

Object Oriented Software Design II Object Oriented Software Design II Introduction to C++ Giuseppe Lipari http://retis.sssup.it/~lipari Scuola Superiore Sant Anna Pisa February 20, 2012 G. Lipari (Scuola Superiore Sant Anna) C++ Intro February

More information

TECHNOLOGY Computer Programming II Grade: 9-12 Standard 2: Technology and Society Interaction

TECHNOLOGY Computer Programming II Grade: 9-12 Standard 2: Technology and Society Interaction Standard 2: Technology and Society Interaction Technology and Ethics Analyze legal technology issues and formulate solutions and strategies that foster responsible technology usage. 1. Practice responsible

More information

DATA STRUCTURES USING C

DATA STRUCTURES USING C DATA STRUCTURES USING C QUESTION BANK UNIT I 1. Define data. 2. Define Entity. 3. Define information. 4. Define Array. 5. Define data structure. 6. Give any two applications of data structures. 7. Give

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

13 Classes & Objects with Constructors/Destructors

13 Classes & Objects with Constructors/Destructors 13 Classes & Objects with Constructors/Destructors 13.1 Introduction In object oriented programming, the emphasis is on data rather than function. Class is a way that binds the data & function together.

More information

Oracle SQL. Course Summary. Duration. Objectives

Oracle SQL. Course Summary. Duration. Objectives Oracle SQL Course Summary Identify the major structural components of the Oracle Database 11g Create reports of aggregated data Write SELECT statements that include queries Retrieve row and column data

More information

PL / SQL Basics. Chapter 3

PL / SQL Basics. Chapter 3 PL / SQL Basics Chapter 3 PL / SQL Basics PL / SQL block Lexical units Variable declarations PL / SQL types Expressions and operators PL / SQL control structures PL / SQL style guide 2 PL / SQL Block Basic

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

MS Access: Advanced Tables and Queries. Lesson Notes Author: Pamela Schmidt

MS Access: Advanced Tables and Queries. Lesson Notes Author: Pamela Schmidt Lesson Notes Author: Pamela Schmidt Tables Text Fields (Default) Text or combinations of text and numbers, as well as numbers that don't require calculations, such as phone numbers. or the length set by

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

System Calls and Standard I/O

System Calls and Standard I/O System Calls and Standard I/O Professor Jennifer Rexford http://www.cs.princeton.edu/~jrex 1 Goals of Today s Class System calls o How a user process contacts the Operating System o For advanced services

More information

PL/SQL Overview. Basic Structure and Syntax of PL/SQL

PL/SQL Overview. Basic Structure and Syntax of PL/SQL PL/SQL Overview PL/SQL is Procedural Language extension to SQL. It is loosely based on Ada (a variant of Pascal developed for the US Dept of Defense). PL/SQL was first released in ١٩٩٢ as an optional extension

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

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

Embedded Systems Design Course Applying the mbed microcontroller

Embedded Systems Design Course Applying the mbed microcontroller Embedded Systems Design Course Applying the mbed microcontroller Memory and data management These course notes are written by R.Toulson (Anglia Ruskin University) and T.Wilmshurst (University of Derby).

More information

COMPUTER SCIENCE (5651) Test at a Glance

COMPUTER SCIENCE (5651) Test at a Glance COMPUTER SCIENCE (5651) Test at a Glance Test Name Computer Science Test Code 5651 Time Number of Questions Test Delivery 3 hours 100 selected-response questions Computer delivered Content Categories Approximate

More information

KB_SQL SQL Reference Guide Version 4

KB_SQL SQL Reference Guide Version 4 KB_SQL SQL Reference Guide Version 4 1995, 1999 by KB Systems, Inc. All rights reserved. KB Systems, Inc., Herndon, Virginia, USA. Printed in the United States of America. No part of this manual may be

More information

Perl in a nutshell. First CGI Script and Perl. Creating a Link to a Script. print Function. Parsing Data 4/27/2009. First CGI Script and Perl

Perl in a nutshell. First CGI Script and Perl. Creating a Link to a Script. print Function. Parsing Data 4/27/2009. First CGI Script and Perl First CGI Script and Perl Perl in a nutshell Prof. Rasley shebang line tells the operating system where the Perl interpreter is located necessary on UNIX comment line ignored by the Perl interpreter End

More information

An Incomplete C++ Primer. University of Wyoming MA 5310

An Incomplete C++ Primer. University of Wyoming MA 5310 An Incomplete C++ Primer University of Wyoming MA 5310 Professor Craig C. Douglas http://www.mgnet.org/~douglas/classes/na-sc/notes/c++primer.pdf C++ is a legacy programming language, as is other languages

More information

Virtuozzo Virtualization SDK

Virtuozzo Virtualization SDK Virtuozzo Virtualization SDK Programmer's Guide February 18, 2016 Copyright 1999-2016 Parallels IP Holdings GmbH and its affiliates. All rights reserved. Parallels IP Holdings GmbH Vordergasse 59 8200

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

We will learn the Python programming language. Why? Because it is easy to learn and many people write programs in Python so we can share.

We will learn the Python programming language. Why? Because it is easy to learn and many people write programs in Python so we can share. LING115 Lecture Note Session #4 Python (1) 1. Introduction As we have seen in previous sessions, we can use Linux shell commands to do simple text processing. We now know, for example, how to count words.

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