The usage of sscanf and sprintf
sscanf is to write str to n in the format of "%d" (from left to right)
Code
//#include<bits/stdc++.h>
#include<cstdio>
#include<iostream>
#include<cstring>
using namespace std;
int main()
{
char str[100]="11111";
int n;
sscanf(str,"%d",&n);
cout<<n;
}
Sprintf writes n into str in the format of "%d" (executed from right to left)
Code
//#include<bits/stdc++.h>
#include<cstdio>
#include<iostream>
#include<cstring>
using namespace std;
int main()
{
char str[100];
int n=11111;
sprintf(str,"%d",n);
cout<<str;
}