-
-
Save spiros/593136d724c16d67d76f62df5f751129 to your computer and use it in GitHub Desktop.
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 <math.h> | |
#include <string.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include "Q93_qrisk2_2015_0.h" | |
#include "Q93_qrisk2_2015_1.h" | |
int main() { | |
char input[100]; | |
const char delims[] = ","; | |
scanf("%s", input); | |
const char *s = input; | |
int i=0; | |
int input_sex; | |
do { | |
size_t field_len = strcspn(s, delims); | |
printf("%d: \"%.*s\"\n", i, (int)field_len, s); | |
if ( i == 1 ) { | |
input_sex = (int)s; | |
} | |
s += field_len; | |
i++; | |
} while (*s++); | |
printf("Sex: %d\n", input_sex); | |
exit(0); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
tuna:QRISK2-2015-lgpl-source spiros$ echo "1,2,3,4,5" | ./qr2
0: "1"
1: "2"
2: "3"
3: "4"
4: "5"
Sex: 1569425938