(a) A string is nothing but an array of characters terminated by ‘\0’.
(b) Being an array, all the characters of a string are stored in contiguous memory locations.
(c) Though scanf( ) can be used to receive multi-word strings, gets( ) can do the same job in a cleaner way.
(d) Both printf( ) and puts( ) can handle multi-word strings.
(e) Strings can be operated upon using several standard library functions like strlen( ), strcpy( ), strcat( ) and strcmp( ) which can manipulate strings. More importantly we imitated some of these functions to learn how these standard library functions are written.
(f) Though in principle a 2-D array can be used to handle several strings, in practice an array of pointers to strings is preferred since it takes less space and is efficient in processing strings.
(g) malloc( ) function can be used to allocate space in memory on the fly during execution of the program.
(b) Being an array, all the characters of a string are stored in contiguous memory locations.
(c) Though scanf( ) can be used to receive multi-word strings, gets( ) can do the same job in a cleaner way.
(d) Both printf( ) and puts( ) can handle multi-word strings.
(e) Strings can be operated upon using several standard library functions like strlen( ), strcpy( ), strcat( ) and strcmp( ) which can manipulate strings. More importantly we imitated some of these functions to learn how these standard library functions are written.
(f) Though in principle a 2-D array can be used to handle several strings, in practice an array of pointers to strings is preferred since it takes less space and is efficient in processing strings.
(g) malloc( ) function can be used to allocate space in memory on the fly during execution of the program.
No comments:
Post a Comment