Entering content frame

 Examples for Permitted VARCHAR Declarations 

Examples for permitted VARCHAR declarations:

VARCHAR a [21], b [100] [133];

typedef VARCHAR longstring [ 65534 ];
longstring c, d;

typedef VARCHAR *PVC;
PVC p;

You can assign memory for p:

n = 100; /* Maximum length of VARCHAR variables*/
p = (PVC) malloc (sizeof (p->len) + n * sizeof (p->arr));

You can declare VARCHAR pointers with fixed maximum lengths as follows:

typedef VARCHAR VC30 [30];
VC30 *q;

q is a pointer to a VARCHAR with a maximum length of 30.

Memory is assigned to q with the following statement:

q = (VC30* ) malloc (sizeof (VC30));

 

Leaving content frame