Ich arbeite mich gerade durch c und habe ein testscript zum lesen der Datentypen geschrieben. Jedoch gibt mir ULONG_MAX ein -1 zurück.
Was mach ich hier falsch?

Zitat von
Manpage limits.h
{ULONG_MAX}
Maximum value of type unsigned long.
Minimum Acceptable Value: 4 294 967 295
PHP-Code:
/* long_limit.c */
#include <stdio.h>
#include <limits.h>
int main(void) {
printf("long-Wert mindestens : %ld\n", LONG_MIN);
printf("long-Wert maximal : %ld\n", LONG_MAX);
printf("unsigned long max. : %ld\n", ULONG_MAX);
printf("long benötigt %d Byte (%d Bit) Speicher\n", sizeof(long), sizeof(long) * CHAR_BIT);
return 0;
}
Code:
./long_limit
long-Wert mindestens : -2147483648
long-Wert maximal : 2147483647
unsigned long max. : -1
long benötigt 4 Byte (32 Bit) Speicher
Lesezeichen