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 <iostream> using namespace std; int fillTable(int *table, int rows, int columns) { if (rows == 0) { for (int cnt = 0; cnt < columns; cnt++) { *(table + cnt) = cnt + 1; } return rows; } else { int offset = fillTable(table, rows - 1, columns); if (offset > 0) { for (int cnt = 0; cnt < columns; cnt++) { //*(table + cnt + columns * offset) = (cnt + 1 + offset) <= columns ? cnt + 1 + offset : (cnt + offset + 1) % columns; int value = (cnt + 1 + offset) <= columns ? cnt + 1 + offset : columns - (cnt + 1 + offset - columns); *(table + cnt + columns * offset) = value; } } offset++; return offset; } } int main() { int rows = 3, columns = 10; int table[rows][columns] = {}; fillTable(&table[0][0], rows, columns); for (int cnt1 = 0; cnt1 < rows; cnt1++) { for (int cnt2 = 0; cnt2 < columns; cnt2++) { cout << table[cnt1][cnt2] << " "; } cout << endl; } 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