当前位置:网站首页>Format character%* s
Format character%* s
2022-07-04 01:59:00 【666QAQ】
Knowledge point
Width and precision format parameters
- It can be omitted
- Or embedded in the format string ( Such as
%8s,%9.2f). - Or in the format string by
*instructions , At this time, it is passed as another function parameter .
for example ,printf("%*d", 5, 10) Will print 10, The total width is 5 Characters .
and printf("%.*s", 3, "abcdef") Will print abc.
%*s
#include <stdio.h>
int main(void)
{
char buf[]="ABCDEFG123456789";
printf("%*s", 10, buf);
return 0;
}
Running results
ABCDEFG123456789
here ,*s Express s Is a variable length , Its length must be indicated by the first parameter after it , The second parameter indicates its content .
- Indicates that the print length is variable
- The next first parameter indicates its length
- The second parameter indicates its content
%.*s
#include <stdio.h>
int main(void)
{
char buf[]="ABCDEFG123456789";
printf("%.*s", 10, buf);
return 0;
}
Running results
ABCDEFG123
therefore ,
*Specified by parameters .%*sAt least*Characters , Fill in the blanks .%.*sMost expressed*Characters , Too much .
Empathy ,%*.*f
边栏推荐
- Yyds dry goods inventory override and virtual of classes in C
- When the watch system of Jerry's is abnormal, it is used to restore the system [chapter]
- Take you to master the formatter of visual studio code
- Use classname to modify style properties
- What is the intelligent monitoring system of sewage lifting pump station and does it play a big role
- Final consistency of MESI cache in CPU -- why does CPU need cache
- What is the student party's Bluetooth headset recommendation? Student party easy to use Bluetooth headset recommended
- Small program graduation design is based on wechat order takeout small program graduation design opening report function reference
- Jerry's synchronous weather information to equipment [chapter]
- Feign implements dynamic URL
猜你喜欢

Some other configurations on Huawei's spanning tree

Example 073 square sum value judgment programming requires the input of a and B, if a ²+ b ² If the result of is greater than 100, a is output ²+ b ² Value, otherwise output the result of a + B.

Make drop-down menu

Small program graduation project based on wechat reservation small program graduation project opening report reference

MySQL advanced SQL statement (1)

Push technology practice | master these two tuning skills to speed up tidb performance a thousand times!

Applet graduation project based on wechat selection voting applet graduation project opening report function reference

From the 18th line to the first line, the new story of the network security industry

Introduction to graphics: graphic painting (I)

Maximum entropy model
随机推荐
What are the advantages and disadvantages of data center agents?
Méthode de calcul de la connexion MSSQL de la carte esp32c3
Remember a lazy query error
Huawei cloud micro certification Huawei cloud computing service practice has been stable
MySQL utilise la vue pour signaler les erreurs, Explicit / show ne peut pas être publié; Verrouillage des fichiers privés pour la table sous - jacente
Why can't it run (unresolved)
Portapack application development tutorial (XVII) nRF24L01 launch C
MySQL introduction - functions (various function statistics, exercises, details, tables)
Chain ide -- the infrastructure of the metauniverse
2020-12-02 SSM advanced integration Shang Silicon Valley
Use classname to modify style properties
How to view the computing power of GPU?
2022 R2 mobile pressure vessel filling certificate examination and R2 mobile pressure vessel filling simulation examination questions
Small program graduation design is based on wechat order takeout small program graduation design opening report function reference
How to subcontract uniapp and applet, detailed steps (illustration) # yyds dry goods inventory #
The reasons why QT fails to connect to the database and common solutions
求esp32C3板子連接mssql方法
Jerry's modification setting status [chapter]
Magical usage of edge browser (highly recommended by program ape and student party)
All ceramic crowns - current market situation and future development trend