[try Beta version]
Not logged in

 
problem with char *array[]declaration

May 2, 2014 at 12:51am
//I get the warning from compiler about this declaration(global):
//copy/paste both: my declaration and warning.
 
 char *S[13] = {"Ellen","Catherine","Aleks","Georgia","Shaun","Sophie","JackS","Matilda","Tommy","Jack","Josh","Luke","Najood"};

//Warning:
15 126 C:\Users\novicius\Documents\rota.cpp [Warning] deprecated conversion from string constant to 'char*' [-Wwrite-strings]

//Project compile and does what it meant to do, but I do not like warnings (nobody does).Syntax is taken from "C++ without fear"(Brian Overland,1st edition 2005).I use Dev-C++ 5.6.2. Thanks for advice.
May 2, 2014 at 1:01am
Use a string type array.
 
string S[13] = {"Ellen","Catherine","Aleks","Georgia","Shaun","Sophie","JackS","Matilda","Tommy","Jack","Josh","Luke","Najood"};

Last edited on May 2, 2014 at 2:50am
May 2, 2014 at 2:17am
Thank you for (quick btw) reply; string type is working without warnings so I am happy with that. I guess book from 2005 could be a bit outdated in some areas, but it is great book anyway.
Topic archived. No new replies allowed.