Vision VTB-101 Guide de l'utilisateur Page 23

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 125
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 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
Vue de la page 22
1 2 ... 18 19 20 21 22 23 24 25 26 27 28 ... 124 125

Commentaires sur ces manuels

Pas de commentaire