Hello guys so my question is can you help me to debug a simple c program with gcc and make it work?
The teacher gave me this code and I should debug it and make it work, i tried but without any help I can't do It.
I compiled it with g++ -g double_free.c -o double_free
The program crashes.
this is the code:
#include <stdlib.h>#include <stdio.h>#define ARRAY_SIZE 100000int main(int argc, char* argv[]){ int i, test=5; int* buf = new int[100000]; for (i=0; i< ARRAY_SIZE; i++){ buf[i] = i; } int result = 0; delete []buf; printf("result: %d\n", result); delete[] buf; printf("test %d\n", test); return 0;}