1 2 3 4

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;

}

posted on 2020-12-16 14:45  三日坊主i  阅读(157)  评论(0)    收藏  举报

导航