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
Printable View
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
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?Quote:
Originally posted by liams7
why on earth are u putting %i and not %d you are using numbers im guessing ?
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!!!Quote:
Originally posted by liams7
because for what he is doing there seems to be no point and it looks so much more sexy LOL
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
C: A Reference Manual
Quote:
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:Quote:
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.
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 .
>So you could go wrong .
That's scanf. This thread is concerning printf. :)
ie, %i and %d are for all intents and purposes the same thing when used with printf.Quote:
Originally posted by Prelude
That's scanf. This thread is concerning printf. :)
~/