online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code   
Language
/****************************************************************************** Welcome to GDB Online. GDB online is an online compiler and debugger tool for C, C++, Python, Java, PHP, Ruby, Perl, C#, VB, Swift, Pascal, Fortran, Haskell, Objective-C, Assembly, HTML, CSS, JS, SQLite, Prolog. Code, Compile, Run and Debug online from anywhere in world. *******************************************************************************/ #include <stdio.h> #define MAX 4 void imprimir (int s[][MAX]) { int i, j; for (i = 0; i < MAX; i++) { for (j = 0; j < MAX; j++) { printf("%d %c",s[i][j],j==MAX-1?' ':'|'); } if (i!=MAX-1) printf("\n--------\n"); } } void transpor(int v[MAX][MAX]){ int transposta[MAX][MAX]; //MAX-1... for(int i=0/*,j=0*/;i<MAX;i++){ for(int j=0;j<MAX;j++){ if(j!=i) transposta[j][i]=v[i][j]; else transposta[i][j]=v[i][j]; /*v[i][j]=v[j][i]; v[j][i]=tmp[i];*/ // NÃO faço printf, porque alguns valores estão em branco e ainda não é pedido.. fazia outra sequência de ciclos com o printf lá dentro! } } imprimir(transposta); } float max(float v[], int n){ float max = v[0]; // experimentar o que o Ricardo Cruz disse for(int i=1/*, float max=v[i]ou 0*/; i<n;i++){ if (max < v[i]) max = v[i]; } return max; } int main() { int matrix[MAX][MAX]={{8,3,5,2},{4,6,9,2},{4,6,4,2},{1,6,7,4}}; float idade[] = {26.5,30.4,30.0,31.9,27.6,33.1}; //printf("%f\n",max(idade,3)); //printf("Com a idade mais avançada tem: %f anos de idade",max(idade,7)); //debug com idade[6] a ver! transpor(matrix); 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