sign « binary « C Data Type Q&A

Home
C Data Type Q&A
1.binary
2.bit
3.byte
4.char
5.character
6.decimal
7.Development
8.float
9.hex
10.integer
11.prime
12.random
13.struct
C Data Type Q&A » binary » sign 

1. Why do unsigned int x = -1 and int y = ~0 have the same binary representation?    stackoverflow.com

In the following code segment what will be:

  • the result of function
  • value of x
  • value of y
    {
         unsigned int x=-1;
 ...

2. Sign extending from a constant bit width in C#    stackoverflow.com

I have a value thats 5 bits in length. 4 bits determine the number and the 5th bit determines the sign, there by holding any value between -16 and +15. How ...

3. How are the values stored in the C unsigned shorts?    stackoverflow.com

I'm trying to read a binary file into a C# struct. The file was created from C and the following code creates 2 bytes out of the 50+ byte rows.

unsigned short ...

4. C, logs, binary, and the number four. they don't mix    stackoverflow.com

#include <stdio.h>
#include <math.h>
/* converts to binary using logs */
int main()
{
    long int decimalNUM = 0, binaryNUM = 0, exponentNUM = 0;
    printf("Enter a number to ...

5. Sign extension from 16 to 32 bits in C    stackoverflow.com

I have to do a sign extension for a 16-bit integer and for some reason, it seems not to be working properly. Could anyone please tell me where the bug is ...

6. Signed integer addition, clarification needed    stackoverflow.com

I have the following signed integers:

(4bits)a = 6;
(4bits)b = 7;
(4bits)c;
c = a + b;
Will c = 13 or c= -3? If I do binary math and assume it's a 4 bit number: ...

7. Tell if a 32 bit signed int is a power of 2    stackoverflow.com

I need to determine if a signed 32 bit number is a power of two. So far I know the first thing to do is check if its negative since negative ...

8. Fastest way to calculate possible values of unsigned int with N unreliable bits?    stackoverflow.com

Given an unsigned int A (32 bit), and another unsigned int B, where B's binary form denotes the 10 "least reliable" bits of A, what is the fastest way to expand ...

9. coverting binary data into unsigned int    bytes.com

Binary data in a file is in bytes (signed or unsigned, this is just a compiler representation) an integer is normally made of either 2 or 4 bytes of data. The data in the file will have 1 of 2 endiannesses either BIG Endian or LITTLE Endian. In big endian the most significant bytes come first, in little endian the most ...

10. conversion of decimal to binary (unsigned )    daniweb.com

#include #include void main() { int i[15],n,q,j; clrscr(); printf("Enter the value of N:"); scanf("%d",&n);//an unsigned value printf("\nBinary Val of %d=",n); q=n;//initialize quotient to n for(j=0;j<16;j++) i[j]=0;//initialize binary vector to zero //calculate the binary Equivalent j=15;//store the Remainder in reverse order if(q!=0) { while(q!=1) { if(j>=0) i[j]=q%2; j--; q=q/2; } i[j]=1; } //print the Binary Equivalent for(j=0;j<=15;j++) printf("%d ",i[j]); getch(); }

java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.