Tuesday 24 July 2012

sscanf() function:c program

sscanf() function using string in c language
sscanf() function:c program

This function is same as scanf() function but it reads from string rather than standard input.

/*Program to illustrate the use of sscanf() function*/

#include
int main()
{
//declare two strings
char s1[20]="1234";
char s2[20]="345.67";
//declare int and float variables
int n;

float f;


//convert the variables into string

sscanf(s1,"%d",&n);

sscanf(s2,"%f",&f);

//print the converted strings

printf("Value of n=%d\nValue of f=%f\n",s1,s2);

}
Share This
Previous Post
Next Post

FYJC XI standard online admisson Process and declaraton of Merit list . Cut off List For prevous year also . 10 Th Results onlne declaraton Maharashtra Region .

0 comments: