| delorie.com/archives/browse.cgi | search |
| From: | "Adrian Smith" <Adrian AT atpelectronics DOT connectfree DOT co DOT uk> |
| Newsgroups: | comp.os.msdos.djgpp |
| References: | <39535e20 AT news DOT telinco DOT net> <8ivoqt$imj$1 AT news1 DOT sunrise DOT ch> |
| Subject: | Re: Pointers and Arrays (Newbie) |
| Date: | Mon, 26 Jun 2000 09:38:36 +0100 |
| Lines: | 31 |
| X-Priority: | 3 |
| X-MSMail-Priority: | Normal |
| X-Newsreader: | Microsoft Outlook Express 5.00.2014.211 |
| X-MimeOLE: | Produced By Microsoft MimeOLE V5.00.2014.211 |
| X-Original-NNTP-Posting-Host: | ppp-1-5.cvx3.telinco.net |
| Message-ID: | <395717d8$1@news.telinco.net> |
| NNTP-Posting-Host: | news2.cluster1.telinco.net |
| X-Trace: | 26 Jun 2000 09:56:53 GMT, news2.cluster1.telinco.net |
| To: | djgpp AT delorie DOT com |
| DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
| Reply-To: | djgpp AT delorie DOT com |
Thanks Simon,
I appreciate what you've said about declerations
and defenitions, but why does it allow you to define the contents of a
character array element in the header file, if all defenitions should be in
cpp-files and declerations in header files. ??
Simon Sulser <simonsulser AT hotmail DOT com> wrote in message
news:8ivoqt$imj$1 AT news1 DOT sunrise DOT ch...
> You should only put declarations in header files and all definitions in
> cpp-files. Maybe you included your header several times in different cpp
> files.
>
> -- header file --
>
> // decleration
> extern char const * message;
>
> -- cpp file --
>
> #include "header.h"
>
> // definition
> char const *message = "Blablablabla";
>
> Of course if you only need message in one cpp file you don't have to write
> the declaration into a header file at all. You can even declare it as
> static, which means it's local to this cpp file.
>
>
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |