fredrik.eriksson

Coffee and a keyboard

Negative sizeof

It’s not that strange passing a negative value to an array but that the array size is negative is funny Smile

#include <stdio.h>
#include <stdlib.h>

int main (int argc, char *argv[])
{
    int size = -100;
    char array[size]; 

    printf("Sizeof: %d\n", sizeof(array)); 

    return 0;
}