TopBottom

Followers



Click on more
SUBSCRIBE

Enter your email address:

Delivered by FeedBurner



VIDEO

Announcement: wanna exchange links? contact me at ravikrak@yahoo.com

Printing of Strings in C language

Posted by Ravi Kumar at Sunday, September 11, 2011
Share this post:
Ma.gnolia DiggIt! Del.icio.us Yahoo Furl Technorati Reddit

Printing of Strings in C language:

The format specification for outting strings
is of the form %w.ps
where w specifies width for display and p
instructs that only the first p characters of
string are to be displayed.The display is right
-justified.
The following examples show the effect of a
variety of specifications in printing a string
"NEW DELHI
110001", containing 16
(including blanks).

Specification & Output:


1) %s
























NEWDELHI110001


2) %20s












L










NEWDEHI110001


3) %20.10s
























NEWDELHI



4) %.5S
























NEWD



5) %-20.10s























NEWDELHI


6) %5s
























NEWDELHI10001
Share |

Labels:

0 comments:

Post a Comment