C语言之sscanf函数
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define _CRT_SCURCE_NO_WARINGS
int main()
{
//sscanf函数就是将字符串内的内容格式化后取出,然后装进相对的数据类型的变量中
int x=123;
char add[] = "安徽粮食学院 12425";
char arr[30];
sscanf(add,"%s %d",arr,&x);
printf("%s \n", arr);
printf("%d \n", x);
system("pause");
return EXIT_SUCCESS;
}
浙公网安备 33010602011771号