Is my syntax ok?
I do not get anything printing.Code:printf("%i+%i=%i\n",array1[r],array1[h],array2[evencount]);
I want it to display similar to the below
1+1=2
Is my syntax ok?
I do not get anything printing.Code:printf("%i+%i=%i\n",array1[r],array1[h],array2[evencount]);
I want it to display similar to the below
1+1=2
"Hence to fight and conquer in all your battles is not supreme excellence;
supreme excellence consists in breaking the enemy's resistance without fighting."
Art of War Sun Tzu
what is the array. Unless the answer is already in the array it won't work. You might want something like thisI think this is standard?Code:printf("%i+%i=%i\n",array[1],array[2],array[1]+array[2]);
why on earth are u putting %i and not %d you are using numbers im guessing ?
Maybe because he want's the functionality that %i has instead of %d -- so why not?Originally posted by liams7
why on earth are u putting %i and not %d you are using numbers im guessing ?
Definition: Politics -- Latin, from
poly meaning many and
tics meaning blood sucking parasites
-- Tom Smothers
because for what he is doing there seems to be no point and it looks so much more sexy LOL
Oh, I don't know about that. I see %d everywhere. I find %i much more mysterious and sexy. I wish they;d introduce the %8 -- va va voom!!!Originally posted by liams7
because for what he is doing there seems to be no point and it looks so much more sexy LOL
Definition: Politics -- Latin, from
poly meaning many and
tics meaning blood sucking parasites
-- Tom Smothers
Reason for the %i.
I'm new to C, and my text book states you can use %i or %d for a place holder for integers, but does not state which is prefered.
Why is %d perfered over %i?
If you want to see the context of my syntax. Take a look at this post.
http://cboard.cprogramming.com/showt...threadid=50662
Last edited by xviddivxoggmp3; 03-16-2004 at 02:04 PM.
"Hence to fight and conquer in all your battles is not supreme excellence;
supreme excellence consists in breaking the enemy's resistance without fighting."
Art of War Sun Tzu
C: A Reference Manual
The i operator is present in Standard C for compatibility with fscanf; it is recognized on output for uniformity, where it is identical to the d operator.
If you like them alone, wait until you get them together:Originally posted by WaltP
Oh, I don't know about that. I see %d everywhere. I find %i much more mysterious and sexy. I wish they;d introduce the %8 -- va va voom!!!
Code:printf("%8i", number );
Quzah.
Hope is the first step on the road to disappointment.
I believe the difference between %i and %d is %i accounts for hexadecimal values, whereas %d is strictly (d)ecimal. So you could go wrong .
Help populate a c/c++ help irc channel
server: irc://irc.efnet.net
channel: #c
>So you could go wrong .
That's scanf. This thread is concerning printf.
My best code is written with the delete key.
ie, %i and %d are for all intents and purposes the same thing when used with printf.Originally posted by Prelude
That's scanf. This thread is concerning printf.
~/