Instructions

199 C-Control Pro IDE
© 2013 Conrad Electronic
Dim str_array(3,40) As Char
Dim Single_str(40) As Char
Single_str="A String"
' will copy Single_str in the second string of str_array
Str_StrCopy(str_array,Single_str,40)
This will work because with a gap of 40 characters after the first string there will in str_array be room
for the second string.
Visibility of Variables
When variables are declared outside of functions then they will have global visibility. I. e. they can be
addressed from every function. Variable declarations within functions produce local variables. Local
variables can only be reached within the function. An example:
Dim a,b As Integer
Sub func1()
Dim a,x,y As Integer
' global b is accessible
' global a is not accessible since concealed by local a
' local x,y is accessible
' u is not accessible since local to function main
End Sub
Sub main()
Dim u As Integer
' global a,b is accessible
' local u is accessible
' x,y u is not accessible since local to function main
End Sub
Global variables have a defined memory space which is available throughout the entire program run.
At program start the global variables will be initialized by zero. Local Variables get not initialized
at the begin of a function!
Local variables will during calculation of a function be arranged on the stack. I. e. local variables ex-
ist in memory only during the time period in which the function is executed.
If with local variables the same name is selected as with a global variable then the local variable will
conceal the global variable. While the program is working in the function where the identically named
variable has been defined the global variable cannot be addressed.
Static Variables
With local variables the property Static can be placed for the data type.