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. *******************************************************************************/ // CPP program to sum two numbers represented two // arrays. #include <bits/stdc++.h> using namespace std; // Return sum of two number represented by the arrays. // Size of a[] is greater than b[]. It is made sure // be the wrapper function void calSumUtil (long a[], long b[], long n, long m) { // array to store sum. long sum[n]; long i = n - 1, j = m - 1, k = n - 1; long carry = 0, s = 0; // Until we reach beginning of array. // we are comparing only for second array // because we have already compare the size // of array in wrapper function. while (j >= 0) { // find sum of corresponding element // of both arrays. s = a[i] + b[j] + carry; sum[k] = (s % 10); // Finding carry for next sum. carry = s / 10; k--; i--; j--; } // If second array size is less the first // array size. while (i >= 0) { // Add carry to first array elements. s = a[i] + carry; sum[k] = (s % 10); carry = s / 10; i--; k--; } long ans = 0; // If there is carry on adding 0 index elements. // append 1 to total sum. if (carry) ans = 10; for(long i=0;i<=n-1;i++) { cout<<sum[i]<<","<<" "; } cout<<"END"; } // Wrapper Function void calSum (long a[], long b[], long n, long m) { // Making first array which have // greater number of element if (n >= m) calSumUtil (a, b, n, m); else calSumUtil (b, a, m, n); } // Driven Program int main () { long n; cin >> n; long a[n]; for (long i = 0; i < n; i++) cin >> a[i]; long m; cin >> m; long b[m]; for (long i = 0; i < m; i++) cin >> b[i]; calSum (a, b, n, m); 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