title: How to compare two unsigned integers (uint8_t) in c
body: <p>I have two uint8_t pointers in my program and I want to compare the values of those. I don't have good idea to deal with unsigned ints. Here is my code</p>
  
  <pre><code>static void bacast_signed_message()
  {
    uint8_t *M = malloc(MAX_M_LEN*sizeof(uint8_t));//uint8_t M[MAX_M_LEN];//uint8_t *M;
    int M_len = MAX_M_LEN;;
  
    uint8_t *C = malloc((2*KEYDIGITS*NN_DIGIT_LEN + 1 + MAX_M_LEN + HMAC_LEN)*sizeof(uint8_t));   
    int C_len; 
    //uint8_t C[2*KEYDIGITS*NN_DIGIT_LEN + 1 + MAX_M_LEN + HMAC_LEN]; 
  
    uint8_t *dM = malloc(MAX_M_LEN*sizeof(uint8_t));  //uint8_t dM[MAX_M_LEN];
    int dM_len = MAX_M_LEN;
  
    random_data(M, MAX_M_LEN);
  
    printf("C before encrypt %p\n",*C);
    printf("M before encrypt %p\n",*M);
    printf("dM before encrypt %p\n",*dM);
  
    C_len = encrypt(C, (2*KEYDIGITS*NN_DIGIT_LEN + 1 + M_len + HMAC_LEN), M, M_len, &amp;pbkey_alice);
    //encrypt(uint8_t *C, int C_len, uint8_t *M, int M_len, Point *PublicKey);
  
    printf("C after encrypt %p\n",*C);
    printf("M after encrypt %p\n",*M);
    printf("dM after encrypt %p\n",*dM);
  
    dM_len = decrypt(dM, dM_len, C, C_len, prKey_alice);   
    //decrypt(uint8_t *M, int M_len, uint8_t *C, int C_len, NN_DIGIT *d);
  
    printf("C after decrypt %p\n",*C);
    printf("M after decrypt %p\n",*M);
    printf("dM after decrypt %p\n",*dM);
  
    printf("C_len = %i , M_len = %i\n",C_len,M_len);
  
    if (dM == M){printf("Works\n");}
    else{printf("Not Works\n");}
  }
  </code></pre>
  
  <p>and this is the out put I got</p>
  
  <pre><code>C before encrypt 0x40
  M before encrypt 0x28
  dM before encrypt 0x70
  C after encrypt 0x4
  M after encrypt 0x28
  dM after encrypt 0x70
  C after decrypt 0x4
  M after decrypt 0x28
  dM after decrypt 0x28
  C_len = 102 , M_len = 41
  Not Works
  </code></pre>
  
  <p>And if I changed private_key(no change of public key) then It looks like  this</p>
  
  <pre><code>C before encrypt 0x40
  M before encrypt 0x28
  dM before encrypt 0x70
  C after encrypt 0x4
  M after encrypt 0x28
  dM after encrypt 0x70
  C after decrypt 0x4
  M after decrypt 0x28
  dM after decrypt 0x70
  C_len = 102 , M_len = 41
  Not Works
  </code></pre>
  
  <p>That mean dM has not changed no. But I am not sure about this. If I use %u instead of %p it will give me totally different answers(it says if we use %u it'll convert to decimal). Please give me some advice, and tell me whats wrong  with this.</p>
  
  <p>Thanks in advance</p>