const char arrays not holding their size or value.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#include <iostream>
#include <conio.h>
#include <cstdio>

using namespace std;

unsigned a_ = 4294967172;
//int atoot = -124;
//char atoot = -124;
const char a = 97, b = 98, c = 99, d = 100, e = 101, f = 102;
//const char goodlist[6] = {a, 'b', 'c', 'd', 'e', 'f'};
const char goodlist[6] = {a, b, c, d, e, f};
const char fuckeduplist[6] = {'a', a_, 'b', 'c', 'd', 'e'};
const char zlist[6] = {'u', 'v', 'w', 'x', 'y', 'z'};



const char a_umlaut = 132;
const char u_umlaut = 129;
const char o_umlaut = 148;
const char nyay = 164;
//const char nyay = 4294967204;
const char A_UMLAUT = 142;
const char U_UMLAUT = 154;
const char O_UMLAUT = 153;
const char NYAY = 4294967205;
const char sset = 225;

const char a_accent = -96;
const char e_accent = -126;
const char i_accent = -95;
const char o_accent = -94;
const char u_accent = -93;

const char A_accent = -75;
const char E_accent = -112;
const char I_accent = -42;
const char O_accent = -32;
const char U_accent = -23;



const
 char germanlist[30] = {'a', a_umlaut, 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', o_umlaut, 'p', 'q', 'r', 's', sset, 't', 'u', u_umlaut, 'v', 'w', 'x', 'y', 'z'};
const
 char spanishlist[32] = {'a', a_accent, 'b', 'c', 'd', 'e', e_accent, 'f', 'g', 'h', 'i', i_accent, 'j', 'k', 'l', 'm', 'n', nyay, 'o', o_accent, 'p', 'q', 'r', 's', 't', 'u', u_accent, 'v', 'w', 'x', 'y', 'z'};
 const char englishlist[26] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};


int main()
{
    cout << "fuckeduplist = " << fuckeduplist << endl;
    cout << "spanishlist = " << spanishlist << endl;
    cout << "goodlist = " << goodlist << endl;


    return 13;
}


I finally played with it long enough and changed the const char's to just plain chars, but at that point my spanish list looked a lot better, all it had appended to it was a smiley face. fuckedup list looked like this though:
aäbcdeäüöñÄÜÖÑßáéíóúÁÉÍÓÚaäbcdefghijklmnoöpqrsßtuüvwxyz



What the heck? What is going on? my const arrays are not const!!!
You're missing a '\0' on the end of those arrays.
Thanks firedraco. What does that do again? eof or something?
It's generally used to mark the end of C-strings, and thus it is what cout uses to determine the end of a char array.
so what happens when I don't have a '\0'? It implements a pointer or something and assumes that the next place in memory is attatched (or pointed to by) the previous character? or something?
It just keeps going until it finds one (which could be anywhere).
Topic archived. No new replies allowed.