4330704 Lecture Notes - Lecture 2: Scanf Format String, Substring, Computer Engineering

25 views18 pages

Document Summary

Basically string is a character array but there is a slight difference between char array and string. Char array are not terminated by null but string automatically terminates by null. String is also defined as number of characters written in double quotation mark. Each string is terminated by the null ( \0") character, which indicates end of string. The null character is automatically appended to the end of the characters in a string constant when they are stored. Alphabets: lower case: a to z, upper case: a to z. Special character: +, -, *, /, %, {}, [], (), , " etc. Declaration and initialization in string: char my_string [] = computer ; //creates an array my_string[] = { c", o", m", p", u", t", Here it will store in memory as: c m p u t e r. Here it will store in memory as: a b c.

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

Related Questions