-
Notifications
You must be signed in to change notification settings - Fork 157
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Gabriel Mocanu <[email protected]>
- Loading branch information
1 parent
9e58b67
commit 6f4139d
Showing
1 changed file
with
8 additions
and
8 deletions.
There are no files selected for viewing
16 changes: 8 additions & 8 deletions
16
curs/chap-04-reprezentare/03-signed-unsigned/signed_unsigned.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,18 @@ | ||
#include <stdio.h> | ||
|
||
unsigned char uc = 0xaa; | ||
signed char sc = 0xaa; | ||
unsigned char unsigned_char = 0xaa; | ||
signed char signed_char = 0xaa; | ||
|
||
short int si = -1; | ||
unsigned int ui; | ||
short int short_int = -1; | ||
unsigned int unsigned_int; | ||
|
||
int main(void) | ||
{ | ||
printf("%hhu, %hhd\n", uc, sc); | ||
printf("%hhu, %hhd\n", unsigned_char, signed_char); | ||
|
||
ui = si; | ||
printf("si (%p): 0x%08x, si: %u, si: %d\n", &si, si, si, si); | ||
printf("ui (%p): 0x%08x, ui: %u, ui: %d\n", &ui, ui, ui, ui); | ||
unsigned_int = short_int; | ||
printf("short_int (%p): 0x%08x, short_int: %u, short_int: %d\n", &short_int, short_int, short_int, short_int); | ||
printf("unsigned_int (%p): 0x%08x, unsigned_int: %u, unsigned_int: %d\n", &unsigned_int, unsigned_int, unsigned_int, unsigned_int); | ||
|
||
return 0; | ||
} |