language: C++ 4.7.2 (gcc-4.7.2)
date: 204 days 22 hours ago
link:
visibility: public
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
@Luchian Grigore I'm using this code your provided but I want to change "Guy" into a const varaible.
 
Can you please help me understand what the different between the following implementation ( all work fine) :
 
    char * const AUTHOR_NAME = "GUY";
 
    static char * AUTHOR_NAME = "GUY";
 
    char * AUTHOR_NAME = "GUY";
 
 
All these are above the main.
 
For some reason the following line didn't work for me : 
 
    char * const AUTHOR_NAME = "GUY";
 
Thaks,
Guy
 
 
 
prog.cpp:1: error: stray ‘@’ in program
prog.cpp:1:19: warning: missing terminating ' character
prog.cpp:1: error: missing terminating ' character
prog.cpp:14:40: warning: missing terminating ' character
prog.cpp:14: error: missing terminating ' character
prog.cpp:1: error: ‘Luchian’ does not name a type
prog.cpp:7: warning: deprecated conversion from string constant to ‘char*’
prog.cpp:9: error: redefinition of ‘char* AUTHOR_NAME’
prog.cpp:7: error: ‘char* AUTHOR_NAME’ previously defined here
prog.cpp:12: error: ‘All’ does not name a type
prog.cpp:18: error: expected constructor, destructor, or type conversion before ‘,’ token
prog.cpp:19: error: expected constructor, destructor, or type conversion at end of input
prog.cpp:7: warning: ‘AUTHOR_NAME’ defined but not used