Alebo ak sa jedná iba o C:
int dlouheCislo = 123456;
int kratkeCislo;
char str[10];
char new_str[3];
sprintf(str,"%d",dlouheCislo);
new_str[0] = str[0];
new_str[1] = str[1];
new_str[2] = '\0';
kratkeCislo = strtol(new_str,NULL,10);
Alebo ak sa jedná iba o C:
int dlouheCislo = 123456;
int kratkeCislo;
char str[10];
char new_str[3];
sprintf(str,"%d",dlouheCislo);
new_str[0] = str[0];
new_str[1] = str[1];
new_str[2] = '\0';
kratkeCislo = strtol(new_str,NULL,10);