COM SCI 31 Chapter Notes - Chapter 9: American Broadcasting Company, C Standard Library, Boolean Expression

52 views4 pages
25 Mar 2017
School
Professor

Document Summary

An array with base type char that stores the characters of a string and marks the end of the a(cid:396)(cid:396)a(cid:455) (cid:862)st(cid:396)i(cid:374)g(cid:863) (cid:449)ith the (cid:374)ull (cid:272)ha(cid:396)a(cid:272)te(cid:396) (cid:858)\(cid:1004)(cid:859) The othe(cid:396) t(cid:455)pe (cid:374)o(cid:396)(cid:373)all(cid:455) used i(cid:374) c++ (cid:894)i. e. st(cid:396)i(cid:374)g s = (cid:862)hello(cid:863)(cid:895) Can use indexes to pick out specific characters within the string (s[(cid:1005)] (cid:449)ould e(cid:395)ual (cid:858)e(cid:859)(cid:895) Null character (cid:858)\(cid:1004)(cid:859) (cid:449)(cid:396)itte(cid:374) as o(cid:374)e si(cid:374)gle (cid:272)ha(cid:396)a(cid:272)te(cid:396) (cid:448)alue e(cid:448)e(cid:374) though t(cid:449)o s(cid:455)(cid:373)(cid:271)ols a(cid:396)e used: sort of like the (cid:374)e(cid:449)li(cid:374)e (cid:272)ha(cid:396)a(cid:272)te(cid:396) (cid:858)\(cid:374)(cid:859) Without this character at the end, the array will no longer be a c-string. library: the above statement is an array of type char with a size of (cid:1007) (cid:894)(cid:449)ithout the (cid:858)\(cid:1004)(cid:859)(cid:895) The li(cid:271)(cid:396)a(cid:396)(cid:455) (cid:862)#include (cid:863) p(cid:396)o(cid:448)ides p(cid:396)edefi(cid:374)ed st(cid:396)i(cid:374)g fu(cid:374)(cid:272)tio(cid:374)s fo(cid:396) c-strings. defi(cid:374)itio(cid:374)s i(cid:374) glo(cid:271)al (cid:374)a(cid:373)espa(cid:272)e so (cid:449)ill (cid:374)ot (cid:374)eed (cid:862)usi(cid:374)g(cid:863) state(cid:373)e(cid:374)ts: different to #include and using namespace std. Must include this if want to access strcpy and strcmp. Do not work because they are arrays.

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