ANSI C Conversion Specifiers for scanf() - C Language Basics

C examples for Language Basics:scanf

Introduction

Conversion Specifier Meaning
%c Read as a character.
%dRead as a signed decimal integer.
%e , %f , %g , %a Read as a floating-point number ( %a is C99).
%E , %F , %G , %ARead as a floating-point number ( %A is C99).
%i Read as a signed decimal integer.
%o Read as a signed octal integer.
%p Read as a pointer (an address).
%s Read as a string. Input begins with the first non-whitespace character and includes everything up to the next whitespace character.
%u Read as an unsigned decimal integer.
%x , %XRead as a signed hexadecimal integer.

Related Tutorials