Course C Initial – 3rd Variables Part. 1
Lesson
3 Part. 1.
Hello
again! As promised in the previous class, now I speak about variables
in C language.
First,
what’s a variable? The answer is important because it will help us
to learn more and use them.
Definition:
capable
of being varied or changed; alterable. (source:
www.dictionary.com).
That’s
the definition that we need!
So,
there’s some variables types in C language. They’re:
-
Global;
-
Locale;
-
Constant;
-
Volatile;
Inside
each one of those cases, we have in resume, 4 type that can be
represent in each or all those cases. Below, you’ll can see its
names.
-
char – ‘a’, ‘b’, ‘c’,...;
-
int – 1, 2, 4, 7,...;
-
float – 7.553279, 8.856347,...;
-
double – 9.5896324789632, 10.5885569347799,...;
There’s
variations inside each format, but we’ll see in the future. How
we can see above, the type data that the variables types represent.
Char is for character data, int is for integer, float is for floating
point and double is a long floating, for greater or smaller numbers.
With
this, we have the enough to declare a variable, show below:
So,
now we learned to declare variables in C language. But I have a NOTE:
Caution
is need when you want use GLOBAL Variables, this type is declared
outside the functions in C and all code knows it and if it wasn’t a
constant, it can be changed and many times, this is unpredictable.
Now,
what the variables make? It reserves memory space. For
help you, read this Article. This space is where is the data in
memory, but when we’re programming, we unknown where the data is
in the memory, we works with variables.
In
the next lesson, we’ll see the second part of this theme. Well,
that’s all folks!
See
you later!
Comentários
Postar um comentário