Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

format specifier problem in c-language

Status
Not open for further replies.

v.s.n.kumar

Member level 1
Joined
Dec 2, 2013
Messages
38
Helped
0
Reputation
0
Reaction score
0
Trophy points
6
Activity points
303
Hi,
can anybody tell what is the result of below lines in c.
main()
{
int i=0x90;
printf("%%d",i);
}
 

if you use 2 % in printf in output you have %d. so your output is %d. but if use printf("%d",i) output is 144 decimal of 90 hex.
 

I know that the result is %d. but what is the reason for giving as %d
 

you should use one %. because % is for formatting and every time that compiler see %,it looks for formatting option, for example d or f. and if you want to print % character, you should use %%.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top