• Image 1
  • Image 2
  • Image 3
  • Image 4
  • Image 5
  • Image 6
  • Image 7




Monday, August 20, 2012

PASCAL - TUTORIAL POINTER

Hi.. welcome to my site in “We Are Knowledge”… In here I was provided you about many IT knowledge, from IT knowledge about dekstop programming until IT knowledge about Web programming.

Now, I want giving you IT knowledge about dekstop programming, that is “pascal” and disscus of “Using command POINTER in pascal”.. You will know, let’s do read my article… have fun and enjoy to read my article !!

Definition about Pointer

Pointer in pascal is structured data types that have been provided by the PASCAL to be made as a variable that stores the address of an object (can be variable, constants of type or subprogram).

Pointer is directions to a location data. because the pointer variable not contain data, but the address of the data

Declaration Of Pointer :

Type var_pointer : ^ identifier_tipe ;
Or
Var var_pointer : ^ identifier_tipe;


Example 1 :


Uses crt;
Type
RecordData            = RECORD
name                                : string [20];
id                        : string [15];
END;
PtrData                     = ^ Record_of_Data;

Var
mhs           : PtrData;
PtrInt        : ^Integer;
Begin
Clrscr;
End.


Pointer can also fill out the address of a variable, and the syntax is :

Var_pointer := @var_fill;


Information :

Var_pointer  = Variable pointer.
Var_fill           = Variable whose contents will be designated by the pointer.
Operator @   = This command to generate the address of the designated variable (var_fill), not the content of these var_fill.

To retrieve the contents and syntax of the data pointed to by a pointer variable (var_fill), use this:

Writeln ( var_pointer^ );

Ok this example from pointer program


Example 2 :

Uses crt;
Type
Pointerinteger = ^integer;
Var
Pointervalue : pointerinteger;
value : integer;
Begin
Clrscr;
value := 56;
Writeln ('Fill of variable value = ',value);
Pointervalue  := @value ;
Writeln ('Value of the designated = ', pointervalue^); Readln;
End.




Press ”alt  + F9” >> compile the program.
Press ”ctrl + F9” >> running the program.

NOTE ::

Please change all quotes (“ “) or (‘ ‘), if you using copy and paste…


To result ::

Fill of variable value = 56               
Value of the designated = 56


Ok just it friends....
Thanks for coming in my page..
See you later

No comments:

Post a Comment