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> #define N 4 #define M 5 int sumaVecinos(int array[][M], int fil, int col) { int suma = 0; suma += (fil + 1 != N) ? array[fil + 1][col] : 0; //Sumar limite inferior. suma += (fil - 1 != -1) ? array[fil - 1][col] : 0; //Sumar limite superior. suma += (col - 1 != -1) ? array[fil][col - 1] : 0; //Sumar vecino izquierdo. suma += (col + 1 != M) ? array[fil][col + 1] : 0; //Sumar vecino derecho. return suma; } int main(void) { int suma; int array[N][M] = { {3, 1, 8, 0, 0}, {1, 4, 1, 0, 3}, {0, 1, 0, 1, 6}, {0, 0, 0, 0, 2} }; for(int i = 0; i < N; i++) { for(int j = 0; j < M; j++) printf("%d\t", array[i][j]); printf("\n"); } for(int i = 0; i < N; i++) { for(int j = 0; j < M; j++) { suma = sumaVecinos(array, i, j); if(suma == array[i][j]) printf("(%d ; %d); = %d\n", i, j, suma); } } 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