Thread: variable def in ANSI C

  1. #1
    Registered User
    Join Date
    Sep 2005
    Posts
    8

    variable def in ANSI C

    What is the maximum variable def length in ANSI C.
    I think it is 32 characters. Is this correct?

  2. #2
    Registered User
    Join Date
    Sep 2005
    Posts
    8
    Variable name length is what I meant.

  3. #3
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544
    31 characters for an internal variable and 6 characters for an external variable. See C89 Draft: Translation Limits. Many/most compilers support more than this.

  4. #4
    Registered Luser cwr's Avatar
    Join Date
    Jul 2005
    Location
    Sydney, Australia
    Posts
    869
    Or in C99:

    - 63 significant initial characters in an internal identifier or a macro name (each
    universal character name or extended source character is considered a single
    character)
    - 31 significant initial characters in an external identifier (each universal character name
    specifying a character short identifier of 0000FFFF or less is considered 6 characters,
    each universal character name specifying a character short identifier of 00010000 or
    more is considered 10 characters, and each extended source character is considered
    the same number of characters as the corresponding universal character name, if any)

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. static class variable vs. global variable
    By nadamson6 in forum C++ Programming
    Replies: 18
    Last Post: 09-30-2005, 03:31 PM
  2. Replies: 10
    Last Post: 09-27-2005, 12:49 PM
  3. variable being reset
    By FoodDude in forum C++ Programming
    Replies: 1
    Last Post: 09-15-2005, 12:30 PM
  4. About classes and HINSTANCE variable to Main
    By conright in forum Windows Programming
    Replies: 2
    Last Post: 01-01-2003, 08:00 PM
  5. creating class, and linking files
    By JCK in forum C++ Programming
    Replies: 12
    Last Post: 12-08-2002, 02:45 PM