Sams Teach Yourself C in 21 Days
33: 34: /* Add the terminating null character. */ 35: 36: *p = ‘\0’; 37: 38: /* Display the string on the screen. */ 39: 40: put ...
Working with Characters and Strings 235 10 You should have noticed that numbers are being assigned to count, which is a type cha ...
Theputs()Function .................................................................................... You’ve already seen the p ...
Working with Characters and Strings 237 10 Theprintf()Function ................................................................. ...
LISTING10.5 get.c. Using gets()to input string data from the keyboard 1: /* Demonstrates using the gets() library function. */ 2 ...
Working with Characters and Strings 239 10 11: /* Display instructions. */ 12: 13: puts(“Enter text a line at a time, then press ...
The gets()function accepts input from the keyboard until it reaches a newline character. The string entered, minus the new line ...
Working with Characters and Strings 241 10 Thegets()Function #include <stdio.h> char *gets(char *str); Thegets()function g ...
What about using the field-width specifier? If you execute the statement scanf(“%3s%3s%3s”, s1, s2, s3); and in response you ent ...
Working with Characters and Strings 243 10 14: 15: /* Input the three data items. */ 16: 17: count = scanf(“%s%s%d”, lname, fnam ...
memory than needed. When you are done with the memory you have allocated, you should always take the time to return it to the sy ...
Working with Characters and Strings 245 10 Q What happens if I put a string into a character array that is bigger than the array ...
Using the ASCII chart in Appendix A, translate the following numeric values to their equivalent characters: a. 73 b. 32 c. 99 d ...
Working with Characters and Strings 247 10 Write code that allocates space for an 80-character string and then inputs a string ...
17 448201x-CH10 8/13/02 11:17 AM Page 248 ...
DAY 11 WEEK 2 Implementing Structures, Unions, and TypeDefs Many programming tasks are simplified by the C data constructs calle ...
Working with Simple Structures ........................................................................ Astructureis a collectio ...
Implementing Structures, Unions, and TypeDefs 251 11 These statements define the structure type coordand declare two structures, ...
advanced techniques. In general, you’ll find structures to be useful whenever information of different variable types should be ...
Implementing Structures, Unions, and TypeDefs 253 11 In lines 16 and 17 you see that the members of myPointare assigned values. ...
«
9
10
11
12
13
14
15
16
17
18
»
Free download pdf