Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > Odd printf() Behavior

Reply
Thread Tools

Odd printf() Behavior

 
 
Keith Thompson
Guest
Posts: n/a
 
      05-10-2013
Ken Brody <(E-Mail Removed)> writes:
> On 5/7/2013 8:17 PM, Brian Dude wrote:
>> On 5/7/2013 7:57 PM, BartC wrote:
>>> "Brian Dude" <(E-Mail Removed)> wrote in message
>>> news:fKfit.18304$(E-Mail Removed)...
>>>
>>>> int chunx;
>>>> int scan;
>>>>
>>>> int main(int argc,char *argv[])
>>>> {
>>>> int slwb; /*Scan Line Width in Bytes*/
>>>
>>>> printf("\nchunx = %d\nslwb = %d\nscan = %d\n",chunx,slwb,scan);
>>>>
>>>> For some reason, the value for 'scan' keeps showing up as 0, only in this
>>>> particular printf() call. Both 'chunx' and 'slwb' show up correctly.
>>>
>>> Is the above the code *exactly* as you have it?

>>
>> It's almost exact, but not 100%.

> [...]
>
> Why not? If you say that a printf() line prints the wrong value for a
> variable, but a different printf() prints the correct value, what make you
> think that giving us the "almost exact" printf() is of any use?
>
> Does the printf() that you gave above, if used "100% exact" as you posted in
> your question, work or not work?
>
> What is the "100% exact" printf() statement that does fail?
>
> Are the definitions of chunx, slwb, and scan "100% exact"? If not, then
> how, exactly, are they defined?


This was addressed a couple of days ago, in Message-ID:
<JoCit.12$(E-Mail Removed)>. slwb was actually defined as a long.
(Yes, the OP has been advised to post real code.)

--
Keith Thompson (The_Other_Keith) http://www.velocityreviews.com/forums/(E-Mail Removed) <http://www.ghoti.net/~kst>
Working, but not speaking, for JetHead Development, Inc.
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Odd behavior with odd code Michael Speer C Programming 33 02-18-2007 07:31 AM
VERY odd routing behavior when attempting VPN connections over Wifi Robert Gordon Wireless Networking 0 08-25-2005 04:04 PM
Firefox under Linux -- odd behavior Dennis J. Tuchler Firefox 0 07-28-2004 04:05 PM
Odd behavior behind the PIX Charles Haron Cisco 1 04-21-2004 04:05 AM
Odd console behavior on Cat 5005 Mike Voss Cisco 0 11-19-2003 10:49 PM



Advertisments