pvjc22/du3/program.c

23 lines
421 B
C
Raw Normal View History

2022-03-17 13:02:02 +00:00
#include <stdio.h>
2022-03-17 18:18:11 +00:00
#include <stdlib.h>
#include <string.h>
#define LINE_SIZE 999
2022-03-17 13:02:02 +00:00
int main(){
2022-03-17 18:18:11 +00:00
char line[LINE_SIZE] = "1 2 3 4";
int len = strlen(line);
char* endptr = NULL;
char* start = line;
int num = 0;
while (start < (line + len)){
num = strtol(start,&endptr,10);
if (num){
printf("Nacital som %d\n",num);
start = endptr + 1;
}
else
break;
2022-03-17 16:29:23 +00:00
}
2022-03-17 13:02:02 +00:00
return 0;
}