Programming in C
220 Chapter 10 Character Strings In the preceding structure definition, you have defined enough space for a 14-letter word (reme ...
Character Strings, Structures, and Arrays 221 char definition[50]; }; / Insert equalStrings function here / // function to look ...
222 Chapter 10 Character Strings else printf ("Sorry, the word %s is not in my dictionary.\n", word); return 0; } Program 10.9 O ...
Character Strings, Structures, and Arrays 223 You can make use of the fact that your dictionary is in alphabetical order to deve ...
224 Chapter 10 Character Strings Now that you have the algorithm for performing a binary search, you can rewrite your lookupfunc ...
Character Strings, Structures, and Arrays 225 else answer = 1; /* s1 > s2 */ return answer; } // Function to look up a word i ...
226 Chapter 10 Character Strings int entries = 10; char word[15]; int entry; int lookup (const struct entry dictionary[], const ...
Character Operations 227 If compareStringsreturns a value of –1—indicating that dictionary[mid].wordis less than search—lookupse ...
228 Chapter 10 Character Strings can be used to print out the value that is used to internally represent the character stored in ...
Character Operations 229 Program 10.11 Converting a String to its Integer Equivalent // Function to convert a string to an integ ...
230 Chapter 10 Character Strings The second time through the loop,intValueis set equal to 4, as calculated by sub- tracting '0'f ...
Exercises 231 where sourceis the character string from which you are extracting the substring, startis an index number into sour ...
232 Chapter 10 Character Strings to be inserted, and the position in the source string where the string is to be inserted. So, t ...
Exercises 233 Write a function called strToFloatthat converts a character string into a floating- point value. Have the functio ...
...
11 Pointers 11 Pointers IN THIS CHAPTER,YOUEXAMINEone of the most sophisticated features of the C pro- gramming language:pointer ...
236 Chapter 11 Pointers You can define another variable, called int_pointer, that can be used to enable you to indirectly access ...
Defining a Pointer Variable 237 Program 11.1 Illustrating Pointers // Program to illustrate pointers include <stdio.h> int ...
238 Chapter 11 Pointers Program 11.2 illustrates some interesting properties of pointer variables. Here, a pointer to a characte ...
Using Pointers in Expressions 239 (and notby the statements char char_pointer; char_pointer = &c; as might be implied from the s ...
«
8
9
10
11
12
13
14
15
16
17
»
Free download pdf