Help me in correcting this. I want the answer as 123 only, but it shows some insane outputs.
#include<iostream>
#include<stack>
#include<string.h>
using namespace std;
int main()
{
char a[] = "123 234 435 - ";
int i = 0;
int b[100];
int j = 0;
while (a[i] != ' ')
{
b[j] = a[i] - '0';
j++;
i++;
// cout<<b[j]<<endl;
}
for (int k = 0; k<j; k++)
{
cout << b[j];
}
}
The notes as comments below