This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*K&R2 Exercise 4-1 "strindex"*/ | |
#include <stdio.h> | |
#define MAX_LINE 1024 | |
int getl(char[], int); | |
int strindex(char[], char[]); | |
char pattern[] = "ould"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*K&R2 Exercise 3-2 "escape"*/ | |
#include <stdio.h> | |
#define MAX_LINE 1024 | |
int getl(char[], int); | |
void escape(char[], char[]); | |
void unescape(char[], char[]); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*K&R2 Exercise 2-9 "lower"*/ | |
#include <stdio.h> | |
int lower(int); | |
int lower(int c) | |
{ | |
return (c >= 'A' && c <= 'Z') ? c + 'a' - 'A' : c; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*K&R2 Exercise 2-7 "invert"*/ | |
#include <stdio.h> | |
unsigned invert(unsigned, int, int); | |
int main() | |
{ | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*K&R2 Exercise 2-6 "setbits"*/ | |
#include <stdio.h> | |
unsigned setbits(unsigned, int, int, unsigned); | |
int main() | |
{ | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*K&R Exercise 2-5 "any"*/ | |
#include <stdio.h> | |
int any(char[], char[]); | |
int main() | |
{ | |
char s1[64] = "Test Tekt Takt"; | |
char s2[10] = "ke"; | |
printf("%d\n", any(s1, s2)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*K&R2 Exercise 2-4 "squeeze"*/ | |
#include <stdio.h> | |
void squeeze(char[], char[]); | |
int main() | |
{ | |
char s1[100] = "Test Mest Kest Sest Vest Mest"; | |
char s2[10] = "sM"; | |
printf("%s\n", s1); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*K&R2 Exercise 2-3 "htoi"*/ | |
#include <stdio.h> | |
#include <ctype.h> | |
int htoi(char[]); | |
int getl(char[], int); | |
int main() | |
{ | |
char s[20]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*K&R2 Exercise 1-22 "fold"*/ | |
#include <stdio.h> | |
#define MAXLINE 1024 | |
#define FOLD 80 | |
int getline(char[], int); | |
int mod(int, int); | |
int main() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*K&R2 Exercise 1-21 "entab"*/ | |
#include <stdio.h> | |
#define TABSTOP 8 | |
int mod(int, int); | |
int main() | |
{ | |
int c, sc, col; |