online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
#include <stdio.h> void readMatrix(int m, int n, int a[][n]); void displayMatrix(int m, int n, int c[][n]); void addMatrix(int m, int n, int a[][n], int b[][n], int c[][n]); int main() { int m, n, p, q; printf("Enter the no. of rows and columns of matrix A\n"); scanf("%d%d", &m, &n); printf("Enter the no. of rows and columns of matrix B\n"); scanf("%d%d", &p, &q); int a[m][n], b[p][q], result[m][n]; if (m != p || n != q) { printf("Matrix addition not possible\n"); return 0; } printf("Enter %d elements to matrix A\n", m * n); readMatrix(m, n, a); printf("Enter %d elements to matrix B\n", m * n); readMatrix(p, q, b); printf("Matrix A\n"); displayMatrix(m, n, a); printf("Matrix B\n"); displayMatrix(p, q, b); addMatrix(m, n, a, b, result); printf("Sum Result\n"); displayMatrix(m, n, result); } void readMatrix(int m, int n, int a[m][n]) { for (int i = 0; i < m; i++) { for (int j = 0; j < n; j++) { scanf("%d", &a[i][j]); } } } void displayMatrix(int m, int n, int a[m][n]) { for (int i = 0; i < m; i++) { for (int j = 0; j < n; j++) { printf("%d ", a[i][j]); } printf("\n"); } } void addMatrix(int m, int n, int a[m][n], int b[m][n], int c[m][n]) { for (int i = 0; i < m; i++) { for (int j = 0; j < n; j++) { c[i][j] = a[i][j] + b[i][j]; } } }

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