int main() { int c; int str[MAX]; for(i = 0; ((c = getchar()) != EOF) && (i < MAX); ++i) { str[i] = c; } str[i] = '\0'; for(i = 0; str[i] != '\n'; ++i); j = i + 1; squeez(str); return 0; }
int main() { char from[] = "hello"; char to[20]; char a[10] = {'1','2','3','4'}; char s[20] = "hai"; char t[6] = "world"; string_copy(to, from); printf("to: %s - from: %s \n", to, from); printf("length = to: %d - from: %d \n", string_length(to), string_length(from)); printf("a[] = %s -- atoi = %d \n", a, atoi(a)); printf("lower: %c \n", lower('C')); printf("upper: %c \n", upper('x')); char name[20] = "sangeeth"; squeez(name, 'e'); printf("squeez(sangeeth) : %s \n", name); printf("strcat(%s, %s): ", s, t); string_concat(s, t); printf("%s \n", s); printf("strrev(%s): ", from); string_reverse(from); printf("%s \n", from); int num = -1234; char numc[10]; itoa(num, numc); printf("itoa(%d): %s \n", num, numc); return 0; }
int main() { char s[] = "this is a test string.. hahaha... "; int c = 'a'; printf("sample string: \n%s\n", s); /* squeez(s, c); printf("final string (without %c): \n%s\n", c, s); c = '.'; squeez(s, c); printf("final string (without %c): \n%s\n", c, s); c = 's'; squeez(s, c); printf("final string (without %c): \n%s\n", c, s); */ c = ' '; squeez(s, c); printf("final string (without %c): \n%s\n", c, s); return 0; }