This file contains 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-12 "1 word per line" | |
#include <stdio.h> | |
main() | |
{ | |
int i; | |
for(i = 0; (i = getchar()) != EOF;){ | |
if(i != ' ') | |
putchar(i); | |
else |
This file contains 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-13 "Histogram of word lengths" | |
#include <stdio.h> | |
#define OUT 0 | |
#define IN 1 | |
#define MAX_WORD_LENGTH 20 | |
main() | |
{ | |
int c = 0, wl = 0, i = 0; |
This file contains 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-19 "Reverse string" | |
#include <stdio.h> | |
#define MAX_LENGTH 1024 | |
int getline(char[], int); | |
void reverse(char[], int); | |
int main() |
This file contains 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
#include <stdio.h> | |
#define TABSTOP 8 | |
int mod(float, float); | |
int main() | |
{ | |
int c, i, cc; |
This file contains 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; |
This file contains 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 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 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 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 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() | |
{ | |
} |
OlderNewer