我正在尝试从输入字符串中对整数和字符串进行排序。
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
#include <string.h>
int main(){
char x[10];
int y;
printf("string: ");
scanf("%s",x);
y=atoi(x);
printf("\n %d", y);
getchar();
getchar(); }
假设输入是 123abc1 使用 atoi 我可以从输入字符串中提取 123,我现在的问题是如何提取 abc1?
我想将 abc1 存储在一个单独的字符变量上。
输入:123abc1 输出:x = 123,一些 char 变量 = abc1
我很感激任何帮助。