The sample EVAL commands presented in Figure 74 and Figure 75 are based on the source shown in the following figure:
Figure 80. Source for Sample EVAL Commands
#include <iostream.h> #include <pointer.h> /** POINTERS **/ _SYSPTR pSys; //System pointer _SPCPTR pSpace; //Space pointer int (*fncptr)(void); //Function pointer char *pc1; //Character pointer char *pc2; //Character pointer int *pi1; //Integer pointer char arr1[] = "ABC"; //Array /** SIMPLE VARIABLES **/
int i1; //Integer
unsigned u1; //Unsigned Integer
char c1; //Character
float f1; //Float
/** STRUCTURES **/
struct { //Bit fields
int b1 : 1;
int b4 : 4;
}bits;
struct x{ // Tagged structure
int x;
char *p;
};
struct y{ // Structure with
int y; // structure member
struct x x;
};
typedef struct z { // Structure typedef
int z;
char *p;
} z;
z zz; // Structure using typedef
z *pZZ; // Same
typedef struct c { // Structure typedef
unsigned a;
char *b;
} c;
c d; // Structure using typedef
/** UNIONS **/
union u{ // Union
int x;
unsigned y;
};
union u u; // Variable using union
union u *pU; // Same
/** ENUMERATIONS **/
enum number {one, two, three};
enum color {red,yellow,blue};
enum number Number = one;
enum color Color = blue;
/** FUNCTION **/
int ret100(void) { return 100;}
int main()
{
float dec1;
struct y y, *pY;
bits.b1 = 1;
bits.b4 = 2;
i1 = ret100();
c1 = 'C';
f1 = 100e2;
dec1 = 12.3;
pc1 = &c1;
pi1 = &i1;
d.a = 1;
pZZ = &zz;
pZZ->z=1;
pY = &y;
pY->x.p=(char*)&y;
pU=&u;
pU->x=255;
Number=(number)Color;
fncptr = &ret100;
pY->x.x=1; // Set breakpoint here
return 0;
}
|
(C) Copyright IBM Corporation 1992, 2005. All Rights Reserved.