Why %i is used? | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
0

Why %i is used?

Format specifiers

7th Sep 2019, 4:21 PM
Pavi .A
Pavi .A - avatar
6 Réponses
+ 2
Pavi .A it's used as format specier for integers. Refer this for other format specifiers https://codeforwin.org/2015/05/list-of-all-format-specifiers-in-c-programming.html and %i differs from %d as %i auto detects base of number when used in scanf statement.
7th Sep 2019, 4:41 PM
🇮🇳Omkar🕉
🇮🇳Omkar🕉 - avatar
0
Actually I am asking why "%i" was used in a program ?...Not just '%'
7th Sep 2019, 4:38 PM
Pavi .A
Pavi .A - avatar
0
yeah yeah... just a minute haha 🤦🏻‍♂️
7th Sep 2019, 4:39 PM
Eze
0
Oh,yeah ! I got it. Thank you✌
7th Sep 2019, 4:44 PM
Pavi .A
Pavi .A - avatar
0
A specification of constant conversion of optional and mandatory fields with this format:   % [marks] [width] [.precision] [size] type   Each field of the conversion specification is a character or number that indicates a format option or a conversion specifier. The mandatory field specifies the type of conversion that will be applied to an argument. The optional marks, width and precision fields control additional formatting aspects, such as initial spaces or zeros, justification and precision shown. The specified size field the size of the argument consumed and converted.   The basic conversion specification contains only the percent sign and one character for type. For example,% s specifies a string conversion. To print a percent sign character, use %%. If a percent sign is followed by a character that has no meaning as a format field, the invalid parameter controller is invoked.
7th Sep 2019, 4:44 PM
Eze
0
Because,% use for showing the division's condition. >>>6%2 this answer is 0
9th Sep 2019, 1:37 PM
Emenap Emenap
Emenap Emenap - avatar