Les Allergies
Alimentaires
Posez votre question Signaler

Var Globale en C <Have a problem in english>

andy - Dernière réponse le 27 août 2002 à 07:58
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
Lire la suite 

Var Globale en C <Have a problem in english> »

1 réponses
Réponse
+0
moins plus
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
Ajouter un commentaire
Ce document intitulé « Var Globale en C <Have a problem in english> » issu de CommentCaMarche (www.commentcamarche.net) est mis à disposition sous les termes de la licence Creative Commons. Vous pouvez copier, modifier des copies de cette page, dans les conditions fixées par la licence, tant que cette note apparaît clairement.
Dossier à la une
Passage au tout numérique : quel coût pour les particuliers ?