Visualizzazione dei risultati da 1 a 2 su 2
  1. #1
    Utente di HTML.it
    Registrato dal
    Jan 2018
    Messaggi
    19

    [C] Problemi con unsigned char

    codice:
    #include <stdio.h>
    void main () 
    {
        const unsigned char a = 255u;
        printf("\nchar: %u\n", a);
        const short b = 512;
        const unsigned long c = 10000000ul;
        unsigned short x;  
        unsigned short y; 
        x = a-b;
        y = (b-a) * c;
        printf("x risulta = %u\n",x);
        printf("y risulta = %u\n",y);
    }

    Non riesco a capire perché il valore x = a - b mi restituisce un valore numerico e soprattutto, non riesco a capire se il valore è esatto.
    Mi sapreste aiutare?

  2. #2
    Utente di HTML.it L'avatar di shodan
    Registrato dal
    Jun 2001
    Messaggi
    2,381
    E cosa ti aspetteresti invece di un valore numerico?
    This code and information is provided "as is" without warranty of any kind, either expressed
    or implied, including but not limited to the implied warranties of merchantability and/or
    fitness for a particular purpose.

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.