"Sava Mikalački" <ba******@nspoint.net> wrote in message
news:br**********@neptun.beotel.net...
Hi there!
My problem consists in this:
When I define an array of char type like this:
char a[]={'a','aa','aaa'};
I get a lot of warnings like
warning C4305: 'initializing' : truncation from 'const int' to 'char'
I've tryed to define the size of it (char a[10] ) but I get same warnings
every time.
What's wrong with this?
char is a single charater. 'a' is a single character.
The constant 'aa' is an implementation defined int consant.
It is NOT a string literal. A string literal would be "".
char a[] is an array of (with this initialization) 3 characters.
It is not an array of strings.
If you want strings, do this:
#include <string>
std::string a[] = { "a", "aa", "aaa" };