2 referring to variable of c language, Referring to variable of c language – FUJITSU SOFTUNE F2 MC-16 User Manual

Page 43

Advertising
background image

29

CHAPTER 1 BASIC FUNCTIONS

1.17.2

Referring to Variable of C Language

C language variables can be specified using the same descriptions as in the source
program written in C language.

Specifying C Language Variables

C language variables can be specified using the same descriptions as in the source program. The address of C

language variables should be preceded by the ampersand symbol "&". Some examples are shown in the Table

1.17-1.

Table 1.17-1 Examples of Specifying Variables

Example of Variables

Example of

Specifying

Variables

Semantics

Regular Variable

int data;

data

Value of data

Pointer

char *p;

*p

Value pointed to by p

Array

char a[5];

a[1]

Value of second element of a

Structure

struct stag {
char c;
int i;
};
struct stag st;
struct stag *stp;

st.c

stp- >c

Value of member c of st
Value of member c of the structure
to which stp points

Union

union utag {
char c;
int i;
} uni;

uni.i

Value of member i of uni

Address of variable

int data;

&data

Address of data

Reference type

int i;
int &ri = i;

ri Same

as

i

Advertising