CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

printf problem

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
bayron kimber
Guest







printf problem
PostPosted: Sat May 17, 2003 3:48 am     Reply with quote

Hi any one
I have problem when I use printf command.
My Example :

long My_var;
.
.
printf("Sample = \%1.2f",My_var);
.
.
when the value in My_var below 1,assume that it was 0.96
The printf will show .96
Why not 0.96?
___________________________
This message was ported from CCS's old forum
Original Post ID: 144514522
Kenny



Joined: 07 Sep 2003
Posts: 173
Location: Australia

View user's profile Send private message

Re: printf problem
PostPosted: Sat May 17, 2003 4:43 pm     Reply with quote

:=Hi any one
:= I have problem when I use printf command.
:=My Example :
:=
:=long My_var;
:=.
:=.
:=printf("Sample = \%1.2f",My_var);
:=.
:=.
:=when the value in My_var below 1,assume that it was 0.96
:=The printf will show .96
:=Why not 0.96?

Probably because you declared My_Var as a long instead of float.
f is for float variables in the printf statement.
Regards
Kenny
___________________________
This message was ported from CCS's old forum
Original Post ID: 144514527
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group