pvjc22/du3/program.c
Yaroslav Orlianskyi bd813885ae DSA
2022-03-17 19:18:11 +01:00

23 lines
421 B
C

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define LINE_SIZE 999
int main(){
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;
}
return 0;
}