Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
Oliver Sedlacek
05/24/12 10:08
Read: 500 times
Uk


 
Msg Score: +1
 +1 Good Answer/Helpful
#187509 - Whats wrong with a header file?
Responding to: Stefan Kanev's previous message
In file "messages.h"

extern const char msg1[];
...
extern const char msg255[];


In file "messages.c"

const char msg1[] = "Hello";
...
const char msg255[] = "Goodbye";

You can #include "message.h" in as many modules as you like and compile and link message.c just once.


List of 15 messages in thread
TopicAuthorDate
const strings in C      Stefan KAnev      05/23/12 23:27      
   Does not compile      Maarten Brock      05/24/12 02:05      
      my question was      Stefan KAnev      05/24/12 04:21      
         Common to play with #define EXTERN      Per Westermark      05/24/12 05:41      
            Common doesn't mean recommended      Oliver Sedlacek      05/25/12 09:43      
               well I recommend it      Erik Malund      05/25/12 10:13      
               No - not hard to maintain at all      Per Westermark      05/25/12 12:44      
   C strings      Per Westermark      05/24/12 03:00      
   Whats wrong with a header file?        Oliver Sedlacek      05/24/12 10:08      
      nothing wrong, double work      Stefan KAnev      05/24/12 11:04      
         It works, and has advantages      Oliver Sedlacek      05/25/12 07:06      
         I got in a total absolute magnificent mess      Erik Malund      05/25/12 07:58      
   thanks to everyone, and next question is      Stefan KAnev      05/25/12 14:46      
      about (tables of) pointers to const strings      Stefan KAnev      05/25/12 14:47      
         C++ and style      Maarten Brock      05/26/12 03:57      

Back to Subject List