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
#include <stdio.h> | |
#define MAX_LINE_LENGTH 100 | |
enum PositionState { | |
POSITION_STATE_WHOLE, | |
POSITION_STATE_DECIMAL, | |
POSITION_STATE_NOTATION | |
}; |
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
#include <stdio.h> | |
int main() { | |
int c; | |
char line[] = ""; | |
for (int i = 0; (c = getchar()) != EOF; i++) { | |
line[i] = c; | |
if (c == '\n') { |
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
#include <stdio.h> | |
// return the index of the first occurrence of any character in matching occuring in string. -1 if none. | |
int any(char string[], char matching[]) { | |
for (int i = 0; string[i] != '\0'; i++) { | |
for (int j = 0; matching[j] != '\0'; j++) { | |
if (string[i] == matching[j]) { | |
return i; | |
} | |
} |
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
#include <stdio.h> | |
// remove all characters in string[] that occur in remove[] | |
void squeeze(char string[], char remove[]) { | |
int i, x; | |
for (i = x = 0; string[i] != '\0'; i++) { | |
int removeChar = 0; | |
for (int j = 0; remove[j] != '\0'; j++) { |
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
#include <stdio.h> | |
long hexToInt(char hexString[]) { | |
long result = 0; | |
for (int i = 0; hexString[i] != '\0'; i++) { | |
if ((hexString[i] == '0' && hexString[i + 1] == 'x') || hexString[i] == 'x') { | |
continue; | |
} |
NewerOlder