Vision VTB-101 Guia do Utilizador Página 23

  • Descarregar
  • Adicionar aos meus manuais
  • Imprimir
  • Página
    / 125
  • Índice
  • MARCADORES
  • Avaliado. / 5. Com base em avaliações de clientes
Vista de página 22
23
VTB USER GUIDE
It's also possible to declare pointers to data STRUCTURES.
Example
This structure is been declared
Used variables:
pointer as *Example pointer to structure Example
struct as Example struct is a structure type variable
pointer=struct() ‘ pointer points to structure
pointer->Var1=300 ‘ writing of both fields of structure by pointer
pointer->Var2=200
As we have seen, to use pointer with the structures we need the token
WARNING: VTB doesn't make any control on the index of pointer therefore with pointers it's possible to write anywhere
in memory with consequent risks to crash the system.
Example:
pnt as *long
value as long
pnt=value()
pnt[10]=1234
The inscrution punt[10] = 1234 doesn't generate any compiling or run-time error, but it can cause unexpected
operations. The correct use is:
pnt[0]=1234
To get the address of a function to assign to a variable we have to refer at the function simply with its name (without
brackets):
Example
VarPnt=MyFunction
Where MyFunction is a declared function
Vista de página 22
1 2 ... 18 19 20 21 22 23 24 25 26 27 28 ... 124 125

Comentários a estes Manuais

Sem comentários