fork download
  1. @Luchian Grigore I'm using this code your provided but I want to change "Guy" into a const varaible.
  2.  
  3. Can you please help me understand what the different between the following implementation ( all work fine) :
  4.  
  5. char * const AUTHOR_NAME = "GUY";
  6.  
  7. static char * AUTHOR_NAME = "GUY";
  8.  
  9. char * AUTHOR_NAME = "GUY";
  10.  
  11.  
  12. All these are above the main.
  13.  
  14. For some reason the following line didn't work for me :
  15.  
  16. char * const AUTHOR_NAME = "GUY";
  17.  
  18. Thaks,
  19. Guy
  20.  
  21.  
  22.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
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
stdout

Standard output is empty