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

int main(void) {
	
	long long int petabyte = 1024LL * 1024LL * 1024LL * 1024LL * 1024LL;	// 10^15
	printf("petabyte %lld \n", petabyte);
	
	volatile char *ptr = (volatile char *)malloc(petabyte);
	printf("malloc() - success, ptr = %p \n", ptr);
	
	ptr[petabyte - 1LL] = 10;
	printf("ptr[petabyte - 1] = 10; - success \n");
	
	printf("ptr[petabyte - 1] = %d \n", (int)(ptr[petabyte - 1LL]));
	
	free((void*)ptr);	// why the error is here?
	//printf("free() - success \n");
	
	return 0;
}
