当前位置:网站首页>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
边栏推荐
- 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
- All ceramic crowns - current market situation and future development trend
- Hunan University | robust Multi-Agent Reinforcement Learning in noisy environment
- Take you to master the formatter of visual studio code
- How to delete MySQL components using xshell7?
- Some other configurations on Huawei's spanning tree
- Example 072 calculation of salary it is known that the base salary of an employee of a company is 500 yuan. The amount of software sold by the employee and the Commission method are as follows: Sales
- TP5 automatic registration hook mechanism hook extension, with a complete case
- Use classname to modify style properties
- When the watch system of Jerry's is abnormal, it is used to restore the system [chapter]
猜你喜欢

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.

Maximum entropy model

51 MCU external interrupt

1189. Maximum number of "balloons"
![[leetcode daily question] a single element in an ordered array](/img/3a/2b465589b70cd6aeec08e79fcf40d4.jpg)
[leetcode daily question] a single element in an ordered array

Huawei cloud micro certification Huawei cloud computing service practice has been stable

Override and virtual of classes in C #

Small program graduation project based on wechat examination small program graduation project opening report function reference

Meta metauniverse female safety problems occur frequently, how to solve the relevant problems in the metauniverse?

Introduction to Tianchi news recommendation: 4 Characteristic Engineering
随机推荐
Magical usage of edge browser (highly recommended by program ape and student party)
Huawei cloud micro certification Huawei cloud computing service practice has been stable
Neo4j learning notes
2022 R2 mobile pressure vessel filling certificate examination and R2 mobile pressure vessel filling simulation examination questions
[typora installation package] old typera installation package, free version
Infiltration learning diary day19
MPLS③
Jerry's watch information type table [chapter]
Some other configurations on Huawei's spanning tree
Mobile phone battery - current market situation and future development trend
LV1 previous life archives
2020-12-02 SSM advanced integration Shang Silicon Valley
Why can't it run (unresolved)
Create template profile
Huawei cloud micro certification Huawei cloud computing service practice has been stable
C import Xls data method summary I (upload files and create Workbooks)
Servlet simple verification code generation
Small program graduation design is based on wechat order takeout small program graduation design opening report function reference
Huawei rip and BFD linkage
Pesticide synergist - current market situation and future development trend