online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code   
Language
#include <stdio.h> #include <string.h> const int MAX_WORD_LENGTH = 25; int compare (char * x, char * y) { int len_x = strlen (x); int len_y = strlen (y); if (len_x != len_y) return len_x - len_y; else { for (int i = 0; i < len_x; ++i) if (x[i] < y[i]) return -1; return 1; } } int main() { int n; scanf ("%d", &n); char numbers[n][MAX_WORD_LENGTH]; for (int i = 0; i < n; ++i) scanf ("%s", numbers[i]); char * max, * min; max = min = numbers[0]; for (int i = 1; i < n; ++i) { if (compare (numbers[i], max) > 0) max = numbers[i]; if (compare (numbers[i], min) < 0) min = numbers[i]; } printf ("Maximum = %s\n", max); printf ("Minimum = %s\n", min); 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