其他分享
首页 > 其他分享> > sscanf与sprintf

sscanf与sprintf

作者:互联网

sscanf与sprintf

#include<stdio.h>
int main(){
	int n;
	char str[100] = "123";
	sscanf(str, "%d", &n);
	printf("%d\n", n);
	return 0;
} 

输出结果:123

#include<stdio.h>
int main(){
	int n = 233;
	char str[100];
	sprintf(str, "%d", n);
	printf("%s\n", str);
	return 0;
}

输出结果:233

标签:sscanf,int,char,sprintf,str,printf
来源: https://www.cnblogs.com/shiff/p/14555821.html