44 lines
661 B
C
44 lines
661 B
C
#include <stdint.h>
|
|
#include <string.h>
|
|
#include <stdio.h>
|
|
|
|
void* malloc(size_t size);
|
|
|
|
int main(void) {
|
|
// char *a = malloc(30);
|
|
// char *b = malloc(16);
|
|
|
|
|
|
// // if (!a || !b) return -1;
|
|
|
|
// a[0] = 'A';
|
|
// a[1] = 'C';
|
|
// b[0] = 'B';
|
|
|
|
// // This will fault (out-of-bounds)
|
|
// // a[20] = 'X';
|
|
|
|
// if (a[1] != 'C') {
|
|
// while (1);
|
|
// }
|
|
|
|
// if (b[0] != 'B') {
|
|
// while (1);
|
|
// }
|
|
|
|
// // free(b);
|
|
// // b = NULL;
|
|
|
|
// // if (b[0] == 'B') {
|
|
// // while (1);
|
|
// // }
|
|
|
|
// char *c = malloc(16);
|
|
|
|
// // if (c[0] != 'B') {
|
|
// // while (1);
|
|
// // }
|
|
|
|
|
|
return 0;
|
|
} |