sscanf function : stdio.h functions in C Programming
sscanf Function : Stdio.h
Syntax :
int sscanf (const char *buffer, const char *format [, address, ...]);
What it actually does ?
- Data is read from array Pointed to by buffer rather than stdin.
- Return Type is Integer
- Return value is nothing but number of fields that were actually assigned a value
Live Example:
char name[20]; int age,salary; sscanf("Ram 23 4000 " ," %s %d %d ",name,&age,&salary);
Explanation of above Example :
- We accept values from user and store them into Respective memory Locations
- But by using sscanf functions instead of accepting data from stdin , we are reading data from the array
- In the above Example “Ram 23 4000″ are three values are assigned to name,age and salary
In short :
Variable Name | Value | |