2. Embedded QUEL for C : C Variables and Data Types : Variable and Type Declarations : The Character String Data Type
 
Share this page                  
The Character String Data Type
Any variables built up from the char data type, except simple variables declared without any C indirection, are compatible with any Ingres character string objects. As previously mentioned, a variable of type char declared without any C indirection is considered an integer variable. The preprocessor treats an array of characters and a pointer to a character string in the same way. Always null-terminate a character string if the string is to be assigned to an Ingres object. automatically null terminates any character string values that are retrieved into C character string variables. Consequently, any variable that you use to receive Ingres values must be declared as the maximum object length, plus one extra byte for the C null string terminator. For more information, see Runtime Character Conversion.
The following example declares three character variables--one integer and two strings:
## char    age;    /* Single byte integer */
## char    *name;  /* To be a pointer to a string */
## charbuf[16];
/*
** To be used to receive at most 15 bytes of string 
** data, plus a null string terminator
*/
For more information on character strings that contain embedded nulls, see The Varying Length String Type.