dev c++ problem

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <iostream>
#include <cstdio>

using namespace std;

int main()
{
char A[14]="100";
char B[14]="100";
cout << enter two big numbers to multiply(1-13 digits): ";

cin >> A[14];
cin >> B[14];

char C[26]="10000";
cout << C << C[26] << endl;
cin >> C[26];
} 


even though it gives no errors/warnings
the characters that can be entered exceed the size of (char A,B,C)
c++ version: 11
Last edited on
For code tags you must use square brackets not angular ones.
cin >> A[14]; is wrong. It is a little confusing that you can use the square brackets to mean two things in C++. char A[14] means that you declare the A array with 14 elements, numbered from 0 to 13. Next time you use cin >> A[14]; means that you want to read only one character, and you assign it to index 14, which is out of bounds.
Topic archived. No new replies allowed.