|
CS256 - Principles of Structured Design
Fall 2021
|
Displaying ./code/sternflCode/Oct19
How wis works
word
|T|H|E|0|.. . |B|E|L|L|0|T|H|E|0|
0 1 2 3 i0 i
two string functions:
#include<string.h>
program: st2.c
strlen string length
strcmp string compare
lexicographical order
dog
dag comes before dog in the dictionary order
a bcdefghijklmno
lower case to upper case 'A'-'a' = 'B'-'b'=...= 'Z'-'z'
'A' 'B'
'a' 'b'
background:
program: st1.c
"Dog" The compiler stores the codes and also a 0 at the end
and it uses the symbol "Dog" to stand for the address of the
first character in the string, 'D'.
address arithmetic: "Dog"+1 is the address of the 'o'.
printf("%s\n", "Dog");
|