online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code   
Language
#include <stdio.h> #include <stdlib.h> #include <pthread.h> #include <unistd.h> typedef struct { int ** data; int rows; int cols; }matrix_t; int init_matrix(matrix_t *mat, int rows, int cols); void delete_matrix(matrix_t *mat); int main() { printf("> Program started\n"); matrix_t mat_A; init_matrix(&mat_A, 1000, 1000); delete_matrix(&mat_A); printf("> Program done\n"); sleep(0); return 0; } int init_matrix(matrix_t *mat, int rows, int cols) { mat->rows = rows; mat->cols = cols; mat->data = (int**)malloc(rows * sizeof(int)); if(!mat->data) { printf("! malloc error (init_matrix 1)\n"); return -1; } for(int i = 0; i < rows; i++) { mat->data[i] = (int*)malloc(cols * sizeof(int)); if(!mat->data[i]) { printf("! malloc error (init_matrix 2)\n"); return -1; } } return 0; } void delete_matrix(matrix_t *mat) { for(int i = 0; i < mat->rows; i++) { free(mat->data[i]); mat->data[i] = NULL; } free(mat->data); mat->data = NULL; }

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text

                

                

Program is not being debugged. Click "Debug" button to start program in debug mode.

#FunctionFile:Line
VariableValue
RegisterValue
ExpressionValue