COMPSCI 210 Part II Strings. Based on McGraw-Hill
|
|
- Kory Walsh
- 7 years ago
- Views:
Transcription
1 COMPSCI 210 Part II Strings Based on McGraw-Hill
2 A String is an Array of Characters Allocate space for a string just like any other array: char outputstring[16]; Space for string must contain room for terminating zero. Special syntax for initializing a string: char outputstring[] = "Result = "; which is the same as: outputstring[0] = 'R'; outputstring[1] = 'e'; outputstring[2] = 's';... outputstring[9] = \0'; //NULL terminator NO String datatype! char word3[] = { 'b', 'a', 's', 'k', 'e', 't', '\0'; Note: You can not assign the value of a C string after the declaration. You need to use a C String function such as strcpy word1 = "one"; ERROR! II-10-2
3 I/O with Strings Printf and scanf use "%s" format character for string Printf -- print characters up to terminating zero printf("%s", outputstring); Scanf -- read characters until whitespace, store result in string, and terminate with zero scanf("%s", inputstring); Note: It doesn't know how big the string is, it can lead to "buffer overflows II-10-3
4 Strings Although there is not string data type in C, C has library <string.h> that can perform actions on strings. Add #include <string.h> if using unix compiler All the functions in <string.h> have parameters or return values as character arrays terminated with null character char *strchr - Find first occurrence of character c in string. char *stpcpy - Copy one string into another. int strcmp - Compare string1 and string2 to determine alphabetic order. char *strcpy - Copy string2 to string1. int strlen - Determine the length of a string. char *strncat - Append n characters from string2 to string1. int strncmp - Compare first n characters of two strings. char *strncpy - Copy first n characters of string2 to string1. int strcasecmp - case insensitive version of strcmp(). int strncasecmp - case insensitive version of strncmp(). II-10-4
5 Character conversions & testing Character testing: int isalpha(int c) -- True if c is a letter. int isdigit(int c) -- True if c is a decimal digit int islower(int c) -- True if c is a lowercase letter int isspace(int c) -- True if c is a space character. int isupper(int c) -- True if c is an uppercase letter. Character Conversion: int toascii(int c) -- Convert c to ASCII. tolower(int c) -- Convert c to lowercase. int toupper(int c) -- Convert c to uppercase. Add #include <ctype.h> if using unix compiler II-10-5
6 Strings Manipulation String Length int strlen(const char *string) Determine the length of a string. printf("%s, length=%d\n", word1, strlen(word1)); Copying char *strcpy(const char *string1,const char *string2) Copy string2 to stringl char *strncpy(const char *string1,const char *string2, size_t n) Copy first n characters of string2 to string1 Note: It returns the first argument which is the destination array. There is no value used to indicate an error If copying takes place between objects that overlap, the behavior is undefined. You must ensure that the destination buffer (s1) is able to contain all the characters in the source array, including the terminating null byte char str[5]; strcpy(str, "ball"); printf("%s, length=%d\n", str, strlen(str)); ball, length=4 II-10-6
7 Strings Manipulation Concatenation char *strcat(const char *string1, char *string2) Append characters from the string2 to string1. char * strncat(const char *string1, char *string2, size_t n) Append n characters from string2 to string1. strcat( str, "-" ); printf("%s, length=%d\n", str, strlen(str)); ball-, length=5 Comparison int strncmp(const char *string1, char *string2) Compare string1 and string2 to determine alphabetic order. Returns < 0 if string1 is lexicographically before string2 Returns ==0 if string1 is equal to string2 Returns > 0 if string1 is lexicographically after string2 int strncmp(const char *string1, char *string2, size_t n) Compare first n characters of two strings. char word1[] = { "basket" ; printf("compare:%d\n", strcmp(word1, "apple")); 1 II-10-7
8 Strings Manipulation Searching char *strchr(const char *string, int c) Find first occurrence of character c in string Parameters: the source string, the char to seek. returns null if not found the substring starting from the first location at which it occurs. char *strrchr(const char *string, int c) Find last occurrence of character c in string. char *strstr(const char *s1, const char *s2) locates the first occurrence of the string s2 in string s1. char *strtok(char *s1, const char *s2) break the string pointed to by s1 into a sequence of tokens, each of which is delimited by one or more characters from the string pointed to by s2. char word1[] = { "basket" ; printf("%s, found=%s\n", word1, strchr(word1,'s')); sket char *str1 = "Hello Big Boy"; printf ("%s\n",strtok(str1,",.-")); printf ("%s\n",strtok (NULL,",.-")); Token will point to the next string Hello Big II-10-8
9 Pointers & Strings The relationship between pointers and strings Same as pointers and array Declaration Declare a pointer and set it to the string Difference You cannot assign the string after declaration, but you can make the character array point to the new string Pointer Access method Exit if the value of a pointer is a NULL character ( \0 ) char str1[] = "Good morning"; cp = str1; while (*cp) { printf("%c", *cp); cp++; Increment the pointer If the value is nonzero, continue char str1[] = "Good"; char *strptr = "Good"; //str1 = good ; strptr = hello ; printf("%s\n", strptr); If it is a null character, the value is zero. Cannot be changed str1 strptr g o o d h e l l o II-10-9
10 Implementation of strlen: Array Style: int strlen(char str[]) { int i = 0; while (str[i]!= \0 ) { i++; return i; Pointer Style: Note: int strlen(char* str) { int i = 0; while (*str!= \0 ) { i++; str++; return i; for (i = 0; str[i]!= '\0'; i++) ; return i; array and pointer declarations interchangeable as function formal parameters because the whole array is never actually passed to a function (the address of the array is) II-10-10
11 Implementation of strcpy: Pointer Style #1 Pointer Style #2, #3 char* strcpy(char* s1, char* s2) { char *dest = s1; char *src = s2; while ((*dest++ = *src++)!= \0 ) ; //body is left empty return s1; char* strcpy(char* s1, char* s2) { char *dest = s1; char *src = s2; while ((*dest = *src)!= \0 ) { dest++; src++; return s1; While the value is nonzero, copy the char, increment both pointers char* strcpy(char* s1, char* s2) { char *dest = s1; char *src = s2; while (*dest++ = *src++) ; //body is left empty return s1; II-10-11
12 Implementation of strcat strchr strcmp char *dest = s1; char *src = s2; while (*dest) dest++; while (*dest++ = *src++) ; return s1; dest now points to the end of s1 (null character) copy s2 into the space at the end of s1 Either point to the end of the while (*s!= '\0 && *s!= (char)c) string or the char we want s++; return ( (*s == c)? (char *) s : NULL ); unsigned char uc1, uc2; while(*s1 && (*s1==*s2)) { s1++; s2++; Compare the characters as unsigned char and return the difference uc1 = (*(unsigned char *) s1); uc2 = (*(unsigned char *) s2); return ((uc1 < uc2)? -1 : (uc1 > uc2)); II-10-12
13 Arrays of Strings Arrays of Strings store an array of character pointers, and each character pointer can point to a string in memory Example: using a 2d array waste of space names Example: using array of character pointers namesptr M a r k \0 J o e \0 A l i c e \0 M a r k \0 J o e \0 A l i c e \0 To print the i th element char names[3][6] = {"Mark", "Joe", "Alice"; char *namesptr[3] = {"Mark", "Joe", "Alice"; printf("%s", *(namesptr+i)); II-10-13
14 Main(), revisited Main supports command line parameters argc: (argument count) the number of parameters argv: command-line argument Note: argv[0] is name by which program is invoked so argc is at least 1 and the first command-line argument is argv[1] int main(int argc, char **argv) { int i; for (i = 1; i < argc; i++) printf("%s\n", argv[i]); return(0); gcc o Demo.c Demo./Demo Joe Alice argv 0 D e m o \0 1 J o e \0 2 A l i c e \0 II-10-14
C Strings and Pointers
Motivation The C++ string class makes it easy to create and manipulate string data, and is a good thing to learn when rst starting to program in C++ because it allows you to work with string data without
More informationASCII 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 informationC Examples! Jennifer Rexford!
C Examples! Jennifer Rexford! 1 Goals of this Lecture! Help you learn about:! The fundamentals of C! Deterministic finite state automata (DFA)! Expectations for programming assignments! Why?! The fundamentals
More informationInformatica 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 informationSources: 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 informationThe 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 information5 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 informationAs 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 informationChapter 2: Elements of Java
Chapter 2: Elements of Java Basic components of a Java program Primitive data types Arithmetic expressions Type casting. The String type (introduction) Basic I/O statements Importing packages. 1 Introduction
More informationNumber Representation
Number Representation CS10001: Programming & Data Structures Pallab Dasgupta Professor, Dept. of Computer Sc. & Engg., Indian Institute of Technology Kharagpur Topics to be Discussed How are numeric data
More information/* 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 informationSoftware security. Buffer overflow attacks SQL injections. Lecture 11 EIT060 Computer Security
Software security Buffer overflow attacks SQL injections Lecture 11 EIT060 Computer Security Buffer overflow attacks Buffer overrun is another common term Definition A condition at an interface under which
More information8.5. <summary>...26 9. Cppcheck addons...27 9.1. Using Cppcheck addons...27 9.1.1. Where to find some Cppcheck addons...27 9.2.
Cppcheck 1.72 Cppcheck 1.72 Table of Contents 1. Introduction...1 2. Getting started...2 2.1. First test...2 2.2. Checking all files in a folder...2 2.3. Excluding a file or folder from checking...2 2.4.
More informationProject 2: Bejeweled
Project 2: Bejeweled Project Objective: Post: Tuesday March 26, 2013. Due: 11:59PM, Monday April 15, 2013 1. master the process of completing a programming project in UNIX. 2. get familiar with command
More information60-141 Introduction to Programming II Winter, 2014 Assignment 2
60-141 Introduction to Programming II Winter, 2014 Assignment 2 Array In this assignment you will implement an encryption and a corresponding decryption algorithm which involves only random shuffling of
More informationChannel Access Client Programming. Andrew Johnson Computer Scientist, AES-SSG
Channel Access Client Programming Andrew Johnson Computer Scientist, AES-SSG Channel Access The main programming interface for writing Channel Access clients is the library that comes with EPICS base Written
More informationChapter 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 informationCSCE 465 Computer & Network Security
CSCE 465 Computer & Network Security Instructor: Dr. Guofei Gu http://courses.cse.tamu.edu/guofei/csce465/ Program Security: Buffer Overflow 1 Buffer Overflow BO Basics Stack smashing Other buffer overflow
More informationBachelors 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 informationBasic Java Constructs and Data Types Nuts and Bolts. Looking into Specific Differences and Enhancements in Java compared to C
Basic Java Constructs and Data Types Nuts and Bolts Looking into Specific Differences and Enhancements in Java compared to C 1 Contents Hello World Program Statements Explained Java Program Structure in
More informationLOW LEVEL FILE PROCESSING
LOW LEVEL FILE PROCESSING 1. Overview The learning objectives of this lab session are: To understand the functions provided for file processing by the lower level of the file management system, i.e. the
More informationObjective-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 informationSo 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 informationSystem Calls Related to File Manipulation
KING FAHD UNIVERSITY OF PETROLEUM AND MINERALS Information and Computer Science Department ICS 431 Operating Systems Lab # 12 System Calls Related to File Manipulation Objective: In this lab we will be
More informationEmbedded 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 informationC 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 informationVariables, Constants, and Data Types
Variables, Constants, and Data Types Primitive Data Types Variables, Initialization, and Assignment Constants Characters Strings Reading for this class: L&L, 2.1-2.3, App C 1 Primitive Data There are eight
More informationFile 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 informationLex et Yacc, exemples introductifs
Lex et Yacc, exemples introductifs D. Michelucci 1 LEX 1.1 Fichier makefile exemple1 : exemple1. l e x f l e x oexemple1. c exemple1. l e x gcc o exemple1 exemple1. c l f l l c exemple1 < exemple1. input
More informationSome Scanner Class Methods
Keyboard Input Scanner, Documentation, Style Java 5.0 has reasonable facilities for handling keyboard input. These facilities are provided by the Scanner class in the java.util package. A package is a
More informationPython Loops and String Manipulation
WEEK TWO Python Loops and String Manipulation Last week, we showed you some basic Python programming and gave you some intriguing problems to solve. But it is hard to do anything really exciting until
More informationAn Implementation of a Tool to Detect Vulnerabilities in Coding C and C++
An Implementation of a Tool to Detect Vulnerabilities in Coding C and C++ GRADUATE PROJECT REPORT Submitted to the Faculty of The School of Engineering & Computing Sciences Texas A&M University-Corpus
More informationAbout 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 informationMember Functions of the istream Class
Member Functions of the istream Class The extraction operator is of limited use because it always uses whitespace to delimit its reads of the input stream. It cannot be used to read those whitespace characters,
More informationMolecular Dynamics Simulations with Applications in Soft Matter Handout 7 Memory Diagram of a Struct
Dr. Martin O. Steinhauser University of Basel Graduate Lecture Spring Semester 2014 Molecular Dynamics Simulations with Applications in Soft Matter Handout 7 Memory Diagram of a Struct Friday, 7 th March
More informationLecture 5: Java Fundamentals III
Lecture 5: Java Fundamentals III School of Science and Technology The University of New England Trimester 2 2015 Lecture 5: Java Fundamentals III - Operators Reading: Finish reading Chapter 2 of the 2nd
More informationChapter 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 informationModule 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 informationCSE 333 SECTION 6. Networking and sockets
CSE 333 SECTION 6 Networking and sockets Goals for Today Overview of IP addresses Look at the IP address structures in C/C++ Overview of DNS Write your own (short!) program to do the domain name IP address
More informationThe 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 informationHow 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 informationFirst 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 informationStacks. Linear data structures
Stacks Linear data structures Collection of components that can be arranged as a straight line Data structure grows or shrinks as we add or remove objects ADTs provide an abstract layer for various operations
More informationObject oriented programming. Course Objectives. On completion of the class, a student should be able: Object Oriented Paradigm
Object oriented programming Course Objectives Object Oriented Paradigm C/C++ Programming Language On completion of the class, a student should be able: to prepare object-oriented design for small/medium
More informationMatrixSSL Porting Guide
MatrixSSL Porting Guide Electronic versions are uncontrolled unless directly accessed from the QA Document Control system. Printed version are uncontrolled except when stamped with VALID COPY in red. External
More informationExceptions in MIPS. know the exception mechanism in MIPS be able to write a simple exception handler for a MIPS machine
7 Objectives After completing this lab you will: know the exception mechanism in MIPS be able to write a simple exception handler for a MIPS machine Introduction Branches and jumps provide ways to change
More informationChapter 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 informationXMOS Programming Guide
XMOS Programming Guide Document Number: Publication Date: 2014/10/9 XMOS 2014, All Rights Reserved. XMOS Programming Guide 2/108 SYNOPSIS This document provides a consolidated guide on how to program XMOS
More informationParallelization: Binary Tree Traversal
By Aaron Weeden and Patrick Royal Shodor Education Foundation, Inc. August 2012 Introduction: According to Moore s law, the number of transistors on a computer chip doubles roughly every two years. First
More informationCS106A, Stanford Handout #38. Strings and Chars
CS106A, Stanford Handout #38 Fall, 2004-05 Nick Parlante Strings and Chars The char type (pronounced "car") represents a single character. A char literal value can be written in the code using single quotes
More informationBeyond the Mouse A Short Course on Programming
1 / 22 Beyond the Mouse A Short Course on Programming 2. Fundamental Programming Principles I: Variables and Data Types Ronni Grapenthin Geophysical Institute, University of Alaska Fairbanks September
More informationSystem 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 informationC++ 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 informationSimple C Programs. Goals for this Lecture. Help you learn about:
Simple C Programs 1 Goals for this Lecture Help you learn about: Simple C programs Program structure Defining symbolic constants Detecting and reporting failure Functionality of the gcc command Preprocessor,
More informationComp151. Definitions & Declarations
Comp151 Definitions & Declarations Example: Definition /* reverse_printcpp */ #include #include using namespace std; int global_var = 23; // global variable definition void reverse_print(const
More informationWe 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 informationC 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 informationC++ 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 informationEmbedded C Programming
Microprocessors and Microcontrollers Embedded C Programming EE3954 by Maarten Uijt de Haag, Tim Bambeck EmbeddedC.1 References MPLAB XC8 C Compiler User s Guide EmbeddedC.2 Assembly versus C C Code High-level
More informationFundamentals of Programming
Fundamentals of Programming Introduction to the C language Giuseppe Lipari http://retis.sssup.it/~lipari Scuola Superiore Sant Anna Pisa February 29, 2012 G. Lipari (Scuola Superiore Sant Anna) The C language
More informationIntroduction to Information Security
Introduction to Information Security 0368-3065, Spring 2015 Lecture 1: Introduction, Control Hijacking (1/2) Eran Tromer Slides credit: Avishai Wool, Tel Aviv University 1 Administration Lecturer: Eran
More informationSimple C++ Programs. Engineering Problem Solving with C++, Etter/Ingber. Dev-C++ Dev-C++ Windows Friendly Exit. The C++ Programming Language
Simple C++ Programs Engineering Problem Solving with C++, Etter/Ingber Chapter 2 Simple C++ Programs Program Structure Constants and Variables C++ Operators Standard Input and Output Basic Functions from
More informationCS 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 informationCS107L Handout 02 Autumn 2007 October 5, 2007 Copy Constructor and operator=
CS107L Handout 02 Autumn 2007 October 5, 2007 Copy Constructor and operator= Much of the surrounding prose written by Andy Maag, CS193D instructor from years ago. The compiler will supply a default (zero-argument)
More informationC++ 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 informationHow to Write a Simple Makefile
Chapter 1 CHAPTER 1 How to Write a Simple Makefile The mechanics of programming usually follow a fairly simple routine of editing source files, compiling the source into an executable form, and debugging
More informationCSC230 Getting Starting in C. Tyler Bletsch
CSC230 Getting Starting in C Tyler Bletsch What is C? The language of UNIX Procedural language (no classes) Low-level access to memory Easy to map to machine language Not much run-time stuff needed Surprisingly
More informationAn Introduction to Assembly Programming with the ARM 32-bit Processor Family
An Introduction to Assembly Programming with the ARM 32-bit Processor Family G. Agosta Politecnico di Milano December 3, 2011 Contents 1 Introduction 1 1.1 Prerequisites............................. 2
More informationProgramming languages C
INTERNATIONAL STANDARD ISO/IEC 9899:1999 TECHNICAL CORRIGENDUM 2 Published 2004-11-15 INTERNATIONAL ORGANIZATION FOR STANDARDIZATION МЕЖДУНАРОДНАЯ ОРГАНИЗАЦИЯ ПО СТАНДАРТИЗАЦИИ ORGANISATION INTERNATIONALE
More informationApplication Security: Web service and E-Mail
Application Security: Web service and E-Mail (April 11, 2011) Abdou Illia Spring 2011 Learning Objectives Discuss general Application security Discuss Webservice/E-Commerce security Discuss E-Mail security
More informationCSE 1223: Introduction to Computer Programming in Java Chapter 2 Java Fundamentals
CSE 1223: Introduction to Computer Programming in Java Chapter 2 Java Fundamentals 1 Recall From Last Time: Java Program import java.util.scanner; public class EggBasket { public static void main(string[]
More informationEnvironnements et Outils de Développement Cours 6 Building with make
Environnements et Outils de Développement Cours 6 Building with make Stefano Zacchiroli zack@pps.univ-paris-diderot.fr Laboratoire PPS, Université Paris Diderot URL http://upsilon.cc/zack/teaching/1314/ed6/
More informationLecture 11 Doubly Linked Lists & Array of Linked Lists. Doubly Linked Lists
Lecture 11 Doubly Linked Lists & Array of Linked Lists In this lecture Doubly linked lists Array of Linked Lists Creating an Array of Linked Lists Representing a Sparse Matrix Defining a Node for a Sparse
More informationChapter 7 Assembly Language
Chapter 7 Assembly Language Human-Readable Machine Language Computers like ones and zeros 0001110010000110 Humans like symbols ADD R6,R2,R6 increment index reg. Assembler is a program that turns symbols
More informationHow Compilers Work. by Walter Bright. Digital Mars
How Compilers Work by Walter Bright Digital Mars Compilers I've Built D programming language C++ C Javascript Java A.B.E.L Compiler Compilers Regex Lex Yacc Spirit Do only the easiest part Not very customizable
More informationPL / 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 informationStack Overflows. Mitchell Adair
Stack Overflows Mitchell Adair Outline Why? What? There once was a VM Virtual Memory Registers Stack stack1, stack2, stack3 Resources Why? Real problem Real money Real recognition Still prevalent Very
More informationC++ Outline. cout << "Enter two integers: "; int x, y; cin >> x >> y; cout << "The sum is: " << x + y << \n ;
C++ Outline Notes taken from: - Drake, Caleb. EECS 370 Course Notes, University of Illinois Chicago, Spring 97. Chapters 9, 10, 11, 13.1 & 13.2 - Horstman, Cay S. Mastering Object-Oriented Design in C++.
More informationThis section describes how LabVIEW stores data in memory for controls, indicators, wires, and other objects.
Application Note 154 LabVIEW Data Storage Introduction This Application Note describes the formats in which you can save data. This information is most useful to advanced users, such as those using shared
More informationCSI 402 Lecture 13 (Unix Process Related System Calls) 13 1 / 17
CSI 402 Lecture 13 (Unix Process Related System Calls) 13 1 / 17 System Calls for Processes Ref: Process: Chapter 5 of [HGS]. A program in execution. Several processes are executed concurrently by the
More informationV850E2/ML4 APPLICATION NOTE. Performance Evaluation Software. Abstract. Products. R01AN1228EJ0100 Rev.1.00. Aug. 24, 2012
APPLICATION NOTE V850E2/ML4 R01AN1228EJ0100 Rev.1.00 Abstract This document describes a sample code that uses timer array unit A (TAUA) of the V850E2/ML4 to evaluate performance of the user-created tasks
More informationiphone Objective-C Exercises
iphone Objective-C Exercises About These Exercises The only prerequisite for these exercises is an eagerness to learn. While it helps to have a background in object-oriented programming, that is not a
More informationShared Memory Segments and POSIX Semaphores 1
Shared Memory Segments and POSIX Semaphores 1 Alex Delis delis -at+ pitt.edu October 2012 1 Acknowledgements to Prof. T. Stamatopoulos, M. Avidor, Prof. A. Deligiannakis, S. Evangelatos, Dr. V. Kanitkar
More informationEXEC SQL CONNECT :userid IDENTIFIED BY :passwd;
SQL with C Test Program 1: Select a row with one column int value; EXEC SQL select max (b) into :value from r; printf ("connected\n"); printf ("max (b) = %d\n", value); Ensure that your library path is
More informationPROBLEM 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 information1 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 informationName: 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 informationSecurity Testing. Davide Balzarotti davide@iseclab.org
Security Testing Davide Balzarotti davide@iseclab.org Administrative News Challenge 1 36 students (3 in the first 24h) Challenge 2 37 students (6 in the first 24h) Challenge 3 34 students (5 in the first
More informationC++ Programming: From Problem Analysis to Program Design, Fifth Edition. Chapter 3: Input/Output
C++ Programming: From Problem Analysis to Program Design, Fifth Edition Chapter 3: Input/Output Objectives In this chapter, you will: Learn what a stream is and examine input and output streams Explore
More informationMemory 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 informationApplication Note. Introduction AN2471/D 3/2003. PC Master Software Communication Protocol Specification
Application Note 3/2003 PC Master Software Communication Protocol Specification By Pavel Kania and Michal Hanak S 3 L Applications Engineerings MCSL Roznov pod Radhostem Introduction The purpose of this
More informationAn Introduction to the C Programming Language and Software Design. Tim Bailey
An Introduction to the C Programming Language and Software Design Tim Bailey Preface This textbook began as a set of lecture notes for a first-year undergraduate software engineering course in 2003. The
More information03 - Lexical Analysis
03 - Lexical Analysis First, let s see a simplified overview of the compilation process: source code file (sequence of char) Step 2: parsing (syntax analysis) arse Tree Step 1: scanning (lexical analysis)
More informationInstall Java Development Kit (JDK) 1.8 http://www.oracle.com/technetwork/java/javase/downloads/index.html
CS 259: Data Structures with Java Hello World with the IntelliJ IDE Instructor: Joel Castellanos e-mail: joel.unm.edu Web: http://cs.unm.edu/~joel/ Office: Farris Engineering Center 319 8/19/2015 Install
More informationCompiler I: Syntax Analysis Human Thought
Course map Compiler I: Syntax Analysis Human Thought Abstract design Chapters 9, 12 H.L. Language & Operating Sys. Compiler Chapters 10-11 Virtual Machine Software hierarchy Translator Chapters 7-8 Assembly
More informationObject-Oriented Design Lecture 4 CSU 370 Fall 2007 (Pucella) Tuesday, Sep 18, 2007
Object-Oriented Design Lecture 4 CSU 370 Fall 2007 (Pucella) Tuesday, Sep 18, 2007 The Java Type System By now, you have seen a fair amount of Java. Time to study in more depth the foundations of the language,
More informationBasics of I/O Streams and File I/O
Basics of This is like a cheat sheet for file I/O in C++. It summarizes the steps you must take to do basic I/O to and from files, with only a tiny bit of explanation. It is not a replacement for reading
More informationBuffer Overflows. Code Security: Buffer Overflows. Buffer Overflows are everywhere. 13 Buffer Overflow 12 Nov 2015
CSCD27 Computer and Network Security Code Security: Buffer Overflows 13 Buffer Overflow CSCD27 Computer and Network Security 1 Buffer Overflows Extremely common bug. First major exploit: 1988 Internet
More informationTopics. 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