variable names

This is a discussion on variable names within the C Programming forums, part of the General Programming Boards category; what's the longest local and/or external name that i can use in a C program? What about C++ names ? ...

  1. #1
    Registered User trekker's Avatar
    Join Date
    Mar 2002
    Posts
    46

    variable names

    what's the longest local and/or external name that i can use
    in a C program? What about C++ names ?
    Is n't system independent ?

    tia

    ps: i could have post this question in the C++ forum too, but
    i prefer this board

  2. #2
    B26354 Deckard's Avatar
    Join Date
    Jan 2002
    Posts
    633
    Short answer: Compiler specific.

    Long answer: According to K&R Second Edition, a variable name may be of any length; however, only the first 31 characters are significant. Compilers are free to extend this beyond 31, and may make any number of characters significant.
    Jason Deckard

  3. #3
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,796
    >only the first 31 characters are significant
    For local variables, variables and functions with external scope are only guaranteed to be signifigant to the first 6 characters.

    -Prelude
    My best code is written with the delete key.

  4. #4
    ....
    Join Date
    Aug 2001
    Location
    Groningen (NL)
    Posts
    2,386
    Though I would recommend not to use very long names. They make code not very readable.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. random variable names
    By NeMewSys in forum C Programming
    Replies: 7
    Last Post: 06-12-2008, 12:26 PM
  2. global and static variable in a class delivered in a DLL
    By George2 in forum C++ Programming
    Replies: 16
    Last Post: 04-13-2008, 09:19 AM
  3. Random Variable names
    By Milhas in forum C Programming
    Replies: 14
    Last Post: 03-26-2008, 06:03 PM
  4. How to manage variable and function names
    By jefflieu in forum C++ Programming
    Replies: 14
    Last Post: 02-07-2008, 03:33 AM
  5. pointers
    By InvariantLoop in forum C Programming
    Replies: 13
    Last Post: 02-04-2005, 09:32 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21