C Programming question
Hello,
I am new to C and wanted to ask what functions would I use if I wanted to force an integer tp print out 5 or 6? |
Quote:
|
Also, if you use a int type for your variable, then that variable will be represented as a signed integer. The size of the integer you can represent is determined by your processor's "word size," typically 32 or 64 bits. Again, typically, the left-most bit represents the sign of the integer, so, for example, a 32-bit processor can represent any integer between -(2^31) and (2^31) in a single word.
If, on the other hand, you're asking about creating a visual symbol on a page or screen to represent the internal binary value as, e.g., a character string of decimal digits, look at the printf command, and read the "formatting" section. (E.g., run man 3 printf) <edit> Note: The above comments are quite general. The actual internal representation of int, short int, long int, negative values, etc., will depend of the specifics of the compiler you're using and the specific CPU for which you're compiling your C code. </edit> |
Just use printf("%c", symbol_decimal_value_in_ASCII_table);
|
Quote:
to print five or six is simply addition |
Quote:
It is, in general, kinder to note that English is not the native language of the majority of the world's population and to try to understand what the OP is trying to ask rather than throwing (figuratively speaking) bricks at their head. |
Quote:
Code:
printf("%d\n", 5 || 6); |
Rather than guessing what the OP meant one should have asked him/here about the real intent.
"As is" the opening post makes not much sense - a variable can have just one value at any given time, so printing 5 or 6 doesn't make much sense to me. |
Quote:
|
Quote:
for (i=1, printf(%d, " "), tp i=1+1 STOP : will print 5 then 6 to CRT. |
Quote:
|
Quote:
|
buy a book.
|
Quote:
Code:
C tutorial |
All times are GMT -5. The time now is 01:15 AM. |