Skip to main content
3 of 6
added 42 characters in body
Florian F
  • 591
  • 4
  • 9

#C

sizeof(char[n][n])

as in

#include <stdio.h>
int main(){
    for( int n=0 ; n<10 ; n++ ){
        printf("%d: %ld\n", n, sizeof(char[n][n]));
    }
}

It works up to INT_MAX in constant time and no memory allocation.

Florian F
  • 591
  • 4
  • 9