Var Globale en C <Have a problem in english>

andy -  
Castor Messages postés 17858 Date d'inscription   Statut Modérateur Dernière intervention   -
Hi All,

It is probably something simple I am missing here but it is driving me
crazy. I have a project I am working on that has 4 source files:

Formulas.c
Utilities.c
FirstDose.c
Results.c

In FirstDose.c I have declared a variable (external to any function in that
file) that I would like to share across all four source files:

Double crcl;

In FirstDose.c I set crcl = CalculateTheCrCl(); CalculateTheCrCl resides
in Formulas.c
The debugger shows crcl = 96.4432... Which is correct.

In Results.c I have the following code:

Extern crcl;
static void FillInResults()
{
Char textP[7];

doubleToString(crcl, textP, 2); //
setFieldTextFromString (ResultsClCrField, textP);
}
These two functions within FillInRestults() reside in Utilities.c.
The debugger shows crcl = 96.4432... Just before dropping into the
doubleToString() function. Once inside doubleToString(), crcl is for some
reason showing up as 16473.

I have used the exact same code for doubleToString() in several other
projects (all consisting of 1 source code file) and it works just fine. What
that heck is wrong here?

Any help is greatly appreciated.

Andy
A voir également:

1 réponse

Castor Messages postés 17858 Date d'inscription   Statut Modérateur Dernière intervention   170
 
Hi Andy...
first of all, this is a french site, so please try to write in french...
then put a significant title to your subject.... everybody in here "has a problem" that the goal of this forum... :-D

for your peculiar problem, i don't really know...
it's a matter of memory addresses....

.O 
(_)__
... Castor
0