I want to number (compute 10) into char for example [1] and conditions if it smaller return 1 else return 1. If you know what i mean? I select lenght char [1] and when i compute string 100+100=200 i want with conditions if else 0 for larger then char [1] and 1 for smaller. Thank you
Code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(void)
{
char src[] = "10 10";
char *data = src;
int pocet;
int v;
int compute = 0;
while (sscanf(data, " %d%n", &v, &pocet) == 1)
{
compute += v;
data += pocet;
printf("cislo: %5d; compute = %5d; pocet = %5d\n", v, compute, pocet);
}
printf("compute = %d\n", compute);
{
char str[5]= {compute,'\0' };
printf("compute = %ld\n", str);
if (str > 10)
printf("0 \n");
else
printf("1 \n");
}
return 0;
}