HP C A.06.05 Reference Manual
Program Organization
Lexical Elements
Chapter 210
Legal Identifiers
meters
green_eggs_and_ham
system_name
UPPER_AND_lower_case
$name
Legal in HP C, but non-standard
Illegal Identifiers
20_meters
Starts with a digit
int
The int type is a reserved keyword
no$#@good
Contains illegal characters
Length of Identifiers
HP C identifiers are unique up to 256 characters.
The ANSI/ISO standard requires compilers to support names of up to 32 characters for local
variables and 6 characters for global variables.
To improve portability, it is a good idea to make your local variable names unique within the
first 32 characters, and global variable names unique within the first 6 characters.
Case Sensitivity in Identifiers
In C, identifier names are always case-sensitive. An identifier written in uppercase letters is
considered different from the same identifier written in lowercase. For example, the following
three identifiers are all unique:
kilograms
KILOGRAMS
Kilograms
Some HP-UX programming languages (such as Pascal and FORTRAN) are case-insensitive.
When writing an HP C program that calls routines from these other languages, you must be
aware of this difference in sensitivity.
Strings are also case-sensitive. The system recognizes the following two strings as distinct:
"THE RAIN IN SPAIN"
"the rain in spain"
#include <stdio.h>
void varfunc(void)
{
printf(“%s\n”, __func__);
/* ... */
}