Weird variables

I made this simple code and ran it. It gave me some weird number like 1699706. What does this number mean?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
        : TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
float B,K,S,A,I;
S=StrToInt(LabeledEdit1->Text);
A=StrToInt(LabeledEdit2->Text);
B=StrToInt(LabeledEdit3->Text);
while(S>0)
{
S=S+A;
S=S-B;
K=B/100*3;
B=B+K;
I++;
}
LabeledEdit4->Text=IntToStr(I);
}
//--------------------------------------------------------------------------- 
Last edited on
It's meaningless because your code doesn't initialize I or K.
Thanks A LOT to you, but I want to know why this happened?
I mean what happens in computer when it meets this line?
Any variables you don't initialize have an undefined value. Generally, they contain whatever garbage happened to be at that memory position.
I know what happened. I met this while debugging another program. If you don't initialize a variable, it's value is the place in the memory. It is 1935234 or something.
I REALLY, REALLY do now.
Topic archived. No new replies allowed.