Valid Name

Write a function with the header

 int validName(const char *name) 

Your function receives the address of a null-terminated string name[] that contains a variable, array or function identifier.  Your function returns a true value if name[] contains a valid variable, array or function identier, a false value if not.

A variable, array or function identifier is valid if it contains letters, digits and underscores in any order, but the first character is not a digit and the identifier is not a keyword.  Keywords are stored as newline-delimited records in a text file named keywords.txt  Each record contains a single keyword.

For example,

validName("if") returns a false value
validName("ii") returns a true value
  Top  Go Back to the Top of this Page

  Designed by Chris Szalwinski   Copying From This Site