Right Click to Search

Saturday, January 23, 2025

stdio.h functions >> sscanf function in C Programming




sscanf Function : Stdio.h
Syntax :
int sscanf (const char *buffer, const char *format [, address, ...]);
What it actually does ?
  1. Data is read from array Pointed to by buffer rather than stdin.
  2. Return Type is Integer
  3. 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 NameValue


Name


Ram


age


23


salary


4000

Tags / Keywords : | ,

Stumble
Delicious
Technorati
Twitter
Facebook

0 Comments:

Post a Comment

Your Feedback :This is Growing Site and Your Feedback is important for Us to improve the Site performance & Quality of Content.Feel Free to contact and Please Provide Name & Contact Email

 

Learn C Programming Copyright © 2010 LKart Theme is Designed by Lasantha, Free Blogger Templates