online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
// Prueba del triangulo de pascal en C #include <stdio.h> #include <stdlib.h> int *CalculateLevel (int Level) { int *Result; Result = (int *) malloc (Level * sizeof (int)); if (Level == 0) *Result = 1; if (Level == 1) { *Result = 1; *(Result + 1) = 1; } if (Level > 1) { int *ResultP = CalculateLevel (Level - 1); for (int i = 0; i < Level; i++) { if (i == 0 || i == Level - 1) *(Result + i) = 1; else *(Result + i) = *(ResultP + i) + *(ResultP + i - 1); } } return (Result); } void DrawPascalTriangle (int Number) { if (Number > 20) { printf ("Solo se admiten 20 niveles"); } else { for (int i = 0; i < (Number + 1); i++) { int *Result = CalculateLevel (i); for (int j = 0; j < i; j++) { printf (" %5d ", *(Result + j)); } printf ("\n"); } } } int main () { int Levels; printf ("Numero de niveles\n"); scanf ("%d", &Levels); DrawPascalTriangle (Levels); 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