After reading these posts I thought I might add my two cents and discuss
the extern keyword.
Before addressing the extern keyword specifically let me take a moment to
talk about scope in C. You have several levels of scope:
Local; only visible inside of the function, value lost on exi
lasses) may not need all globals.
Paul
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Jay
Francis
Sent: Thursday, April 18, 2002 12:26 PM
To: Palm Developer Forum
Subject: How to create a global variable?
Thanks to Brian and Paul.
I got it to work. Howev
The 'extern' is a C language construct ... Time to brush
up your C skills! ;-)
On Thu, 18 Apr 2002 13:25:52 -0500, Palm Developer Forum
<[EMAIL PROTECTED]> said:
>Thanks to Brian and Paul.
>
>I got it to work. However I am curious how you knew
>this.
>The only reference to extern I find rela
Thanks to Brian and Paul.
I got it to work. However I am curious how you knew
this.
The only reference to extern I find relates to
libraries and that was in the Target Palm OS.pdf.
I searched all the pdf documentation included with
codewarrior and that was all there was.
I put the extern Char *g
, 2002 8:01 AM
To: Palm Developer Forum
Subject: How to create a global variable?
Creating a global variable:
I tried to create a global variable and test to see the
scope of that variable
in a custom alert. So I created a variable called
gJay.
Char * gJay = "Jay";
When I put this c
Yep. So in main.c you have:
Char *gJay="Jay";
... and in Information.c you have:
extern Char *gJay;
Kind regards,
Brian
On Thu, 18 Apr 2002 09:34:28 -0500, Palm Developer Forum
<[EMAIL PROTECTED]> said:
>Thanks Brian,
>Do you mean I declared it correctly and in addition I
>need to put th
Thanks Brian,
Do you mean I declared it correctly and in addition I
need to put the code you suggested in each of the .c
files?
Jay
>From Brian:
In the other sources (not main.c):
extern Char *gJay;
>Creating a global variable:
>
>I tried to create a global variable and test to see the
>sc
In the other sources (not main.c):
extern Char *gJay;
On Thu, 18 Apr 2002 09:00:44 -0500, Palm Developer Forum
<[EMAIL PROTECTED]> said:
>Creating a global variable:
>
>I tried to create a global variable and test to see the
>scope of that variable
>in a custom alert. So I created a variable
Creating a global variable:
I tried to create a global variable and test to see the
scope of that variable
in a custom alert. So I created a variable called
gJay.
Char * gJay = "Jay";
When I put this code in the main.c file (the file that
has the MainFormInit function in it)
below the # incl