Scanf function c programming Hindi tutorials

Scanf function c programming Hindi tutorials: Aaj ke ish tutorial me hum c programming me Scanf function ke bare me padheng. or yeh dekhenge ki scanf function ko program me kaise or kyu use kiya jata hai. 


Scanf function c programming Hindi tutorials
scanf function

Scanf function c programming Hindi tutorials

Scanf function definition:

Scanf function ek inbuilt function hai. jo ki stdio.h header file me declare hai. Scanf function ko program me use Karne ke liye hame sabse pahle stdio.h header file ko include Karna padta hai. iske baad hum Scanf function ko use kar skte hai. 
Scanf function ko hum program me integer, float, character, string, decimal, binary or hexadecimal input lene ke liye karte hai. input lene ke alawa bhi scanf function ke bahut se use hote hai. par unko hum aage ke tutorials me padhenge. 

Syntax:

scanf("%format_specifier",&variable_name);
Example:
scanf("%d",&a);

  • %d = format_specifier
  • a    = variable_name

Note: scanf function ko samajne se pahle aapko format specifiers ke bare me samjna jaruri hai. bina format specifiers ko samje aapko yeh samaj me nahi aayega ki scanf function ko program me kaise use karte hai.  

Note: Format specifier ke bare me padhne ke liye ish post ko read kare. 

ish post ko padhne ke baad aapko yeh samaj me aa jayega ki aapko format specifier ka use kaise karna hai. 

Aab maan lijiye ki aapko ek integer variable a ki value ko scan karna hai scanf function ki madad se. to aako pata hi hoga ki aapko %d format specifier ko use karna hai. kyuki hame integer value ko scan karna hai. 


Example:

scanf("%d",&a);
  • %d = format specifier integer variable ke liye.
  • &    = reference
  • a    = variable name 

Note: & ek reference symbol hai. jab bhi hum kisi variable ke saath & ka use karte hai to hum ush variable ke address ko refer karte hai. 

Agar hum integer variable ko scan karte hai. or hum float value ko input me dete hai to compiler garbage value ko input me lega. 


Note: hum pahle hi dekh chuke hai ki integer variable ko scan kaise karte hai. 


Scan Float variable.


  • %f = format_specifier float variable ke liye.
  • a   = variable name
Syntax:

scanf("%f",&a);

Scan Character variable.

  • %f = format_specifier Character variable ke liye.
  • a   = variable_name
Syntax:

scanf("%c",&a);  
thanks for reading this post and do share this post with your friends. 
 Scanf function c programming Hindi tutorials

Post a Comment

0 Comments