Printf function C programming Hindi tutorials

Printf function C programming Hindi tutorials: aaj ke ish tutorial me hum c programming me  printf function ke baare me padhenge. or dekhenge ki printf function ko kyu or kaise use kiya jata hai. kaise usme variables ki values ko print kiya jata hai. 

Printf function C programming Hindi tutorials, hindi tutorials
printf function

Printf function c programming Hindi tutorials:

Printf function Definition:

Printf function ek inbuilt function hai. jo ki stdio.h header file me declare hai. printf function ko program me use Karne ke liye hame sabse pahle stdio.h header file ko include Karna padta hai.  iske baad hum printf function ko use kar skte hai. 

Printf function ka use hum output screen par message, integer, float, character, string, decimal, binary or hexadecimal values ko print karvane ke liye karte hai.


Note: abhi tak aapne header file ke baare me nahi padha hai to is article ko padhe. 


Syntax:

printf("Message %format_specifier", reference_variable);
Example
printf("Hello c programming version %d", a); 
  • Message = Hello c programming version
  • format_specifier = %d
  • reference_variable = a
Note: lakin printf function ko samajne se pahle aapko format specifier ke baare me janana hoga. tabhi aap printf function ko achi tarike se samaj payenge.

Format Specifiers:

Format specifiers vo specifiers hote hai jo ki compiler ko batata hai ki kish type ki value ek variable input me lega or output me dega.
Note: aage ke tutorials me hum data types ke baare me padhenge tab aapko format specifiers ke baare me ache se samaj me aa jayega. 
abhi bas aapko yeh janna hai ki format specifiers ko kaise use karte hai. 
yaha par kuch format specifiers or unke data types diye gaye hai jinko aapko yaad rakha hoga. 

Printf function C programming Hindi tutorials
specifiers
Note: upar diye gye specifiers ke alawa or bhi kai sare specifiers hai. or advance topic ke liye is post ko padhe. 

aage ke tutorials me hum data types ke baare me details me padhenge tab aapko specifiers ke baare me pura knowledge ho jayega. tab tak ke liye aap in specifiers symbols ko yaad rakhe.



Specifiers syntax:

%symbol
  • c - the symbol for character variable.
  • f - the symbol for the float variable.
  • d - the symbol for an integer variable.
  • s - the symbol for a string variable.


Printing message and variable's values using printf() function.

sabse pahle aapko basic syntax yaad rakha hoga printf function ka. 

syntax:

printf("text message %symbol", variable);

Note: aapko hamesa yahi syntax follow karna hai. printf function ko use karte samaye. symbol ki jagah aapko specifiers ka use karna hai variable ke respective.

Integer value printing:

maan lijiye aapko ek intger variable diya gay hai a=30. or ab aapko ish variable ki value printf function ki sahayta se output screen par print karvani hai. to aapko %d specifier ka istamal karna hoga. 

Example:

printf("value of a: %d", a);
Output:
value of a: 30

Float value printing:

specifier = %f 
Example:
float a=20.2            
printf("value of a: %f",a);
Output
value of a: 20.2

Character value printing:

specifier = %c
Example:
char a= 'A';            
printf("Value of a: %c",a);
Output
Value of a: A
Note: jaise jaise topics aage badte jayenge. hum specifiers ke baare me or bhi jayada jange.   
kisi bhi question se related answer ke liye comment box me likhe.
Printf function C programming Hindi tutorials

Post a Comment

0 Comments