online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code   
Language
/****************************************************************************** Online C Compiler. Code, Compile, Run and Debug C program online. Write your code in this editor and press "Run" button to compile and execute it. *******************************************************************************/ #include <stdio.h> #include <stdlib.h> #include <time.h> #include <float.h> #include <math.h> const float RAND_MAX_F = RAND_MAX; float get_rand() { return rand() / RAND_MAX_F; } float randfloat(const float min, const float max) { return get_rand() * (max - min) + min; } int main() { float **arr; int n; int m; float max_elem; printf("Enter n: "); scanf("%d", &n); printf("Enter m: "); scanf("%d", &m); arr = calloc(sizeof(float*), n); for(int i = 0; i < n; i++) arr[i] = calloc(sizeof(float), m); srand(time(NULL)); for(int i = 0; i < n; i++) { for(int j = 0; j < m; j++) { arr[i][j] = randfloat(-50.0, 50.0); printf("%6.2f ", arr[i][j]); if (i == 0 && j == 0) max_elem = fabsf(arr[i][j]); else if (fabsf(arr[i][j]) > max_elem) max_elem = fabsf(arr[i][j]); } printf("\n"); } printf("\nmax_elem: %.2f\n\n", max_elem); for(int i = 0; i < n; i++) { for(int j = 0; j < m; j++) { arr[i][j] = arr[i][j] / max_elem; printf("%6.2f ", arr[i][j]); } printf("\n"); } for(int i = 0; i < n; i++) free(arr[i]); free(arr); return 0; }

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