Arrays, Pointers, Strings
Note: All the programs mentioned in this lecture are in:/home/cs352/SUMMER02/lecture9progs/
For an example of arrays, pointers - see bubblesort.c, mergesort.c -STRINGS - One dimensional arrays of type char. - Ends with '\0', null character.(Included in size) - String constants are in double quotes, "abcde" - A string consant in fact is a pointer, that has as value the base address of the string. see strconst.c see wordcount.c -STRING HANDLING FUNCTIONS - See Appendix-B of the textbook(string.h) - char *strcat(char *s1, const char *s2); concatenates strings s1, s2 and puts the result in s1. (must make sure that s1 has enough space.) - int strcmp(const char *s1, const char *s2); compares strings s1 and s2, returns int that is less than, equal to or greater than 0 depending on the comparison result. - char *strcpy(char *s1, const char *s2); copies string s2 into s1 (must make sure that s1 has enough space) - unsigned strlen(const char *s); # of characters in string s, before \0 is returned. see strings.c