ข้ามไปที่เนื้อหาหลัก

บทความ

กำลังแสดงโพสต์ที่มีป้ายกำกับ printf c

printf format reference

จดไว้กันลืม d , i Print an int as a signed decimal number. ' %d ' and ' %i ' are synonymous for output, but are different when used with scanf () for input. u Print decimal unsigned int . (short) // can print unsigned char as well f , F Print a double in normal ( fixed-point ) notation. 'f' and 'F' only differs in how the strings for an infinite number or NaN are printed ('inf', 'infinity' and 'nan' for 'f', 'INF', 'INFINITY' and 'NAN' for 'F'). e , E Print a double value in standard form ([-]d.ddd e[+/-]ddd).An E conversion uses the letter E (rather than e) to introduce the exponent. The exponent always contains at least two digits; if the value is zero, the exponent is 00. g , G Print a double in either normal or exponential notation, whichever is more appropriate for its magnitude. 'g' uses lower-case letters, 'G' uses upper-case letters. This type ...