ENGR 101 Lecture Notes - Lecture 19: Empty String, Concatenation, Newline

38 views2 pages
School
Department
Course
Professor

Document Summary

A string is a sequence of characters: use string datatype. You must use string library: #include String with no characters is called an empty string. String literals are hardcoded strings specified by a sequence of characters in double. If (cid:455)ou do(cid:374)(cid:859)t i(cid:374)itialize a stri(cid:374)g it (cid:449)ill (cid:271)e e(cid:373)pt(cid:455) (cid:271)(cid:455) default quotes: ca(cid:374)(cid:859)t (cid:271)e (cid:373)odified. Concatenation: process of appending two strings together one after the other, the + operator performs this, += operator updates a variable by concatenating an additional string onto it. String comparison: string database supports the regular relational operators, based on alphabetical ordering. String datatype is a sequence of char datatype. Char representation in memory, they are sorted as numbers. If (cid:455)ou tr(cid:455) to (cid:272)out i(cid:374)t (cid:454) = (cid:858)a(cid:859) it (cid:449)ould pri(cid:374)t 97: or 3+4 would be 103. Special character: some ascii codes are used to represent non-printable characters with special meanings. Escape sequences: some special characters like newline would interfere with the syntax of our program.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents