473,387 Members | 2,436 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

C Variables Length

lak
Hello firends.
I want to know what is the variable length in c.
I K&R they stated that atleast 31 character.
But I give 1 lakhs length to a variable, but my compiler doesn't say
any error.
It accepts it.Then what is the maximum length to a variable.?

Dec 14 '07 #1
11 1906
On Dec 14, 2:53 pm, lak <l...@nospam.invalidwrote:
Hello firends.
I want to know what is the variable length in c.
I K&R they stated that atleast 31 character.
But I give 1 lakhs length to a variable, but my compiler doesn't say
any error.
It accepts it.Then what is the maximum length to a variable.?
A more appropriate reference is the C language standard. It says:

5.2.4.1 Translation limits
1 The implementation shall be able to translate and execute at least
one program that contains at least one instance of every one of the
following limits:13)
* 127 nesting levels of blocks
* 63 nesting levels of conditional inclusion
* 12 pointer, array, and function declarators (in any combinations)
modifying an arithmetic, structure, union, or incomplete type in a
declaration
* 63 nesting levels of parenthesized declarators within a full
declarator
* 63 nesting levels of parenthesized expressions within a full
expression
* 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 short identifier of 0000FFFF or
less is considered 6 characters, each universal character name
specifying a 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)14)
* 4095 external identifiers in one translation unit
* 511 identifiers with block scope declared in one block
* 4095 macro identifiers simultaneously defined in one preprocessing
translation unit
* 127 parameters in one function definition
* 127 arguments in one function call
* 127 parameters in one macro definition
* 127 arguments in one macro invocation
* 4095 characters in a logical source line
* 4095 characters in a character string literal or wide string literal
(after concatenation)
* 65535 bytes in an object (in a hosted environment only)
* 15 nesting levels for #included files
* 1023 case labels for a switch statement (excluding those for any
nested switch statements)
* 1023 members in a single structure or union
* 1023 enumeration constants in a single enumeration
* 63 levels of nested structure or union definitions in a single
struct-declaration-list

So you can have up to 63 *initial* characters in an internal
identifier. That means you might make one 100 characters long, but
only the first 63 would be recognized to differentiate it from other
identifiers.
Some pre-C99 implementations may limit to 31 *initial* characters in
an internal identifier. That means you might make one 100 characters
long, but only the first 31 would be recognized to differentiate it
from other identifiers.
Dec 14 '07 #2
lak <la*@nospam.invalidwrites:
I want to know what is the variable length in c.
I K&R they stated that atleast 31 character.
But I give 1 lakhs length to a variable, but my compiler doesn't say
any error.
The number of significant characters in an identifier varies
among implementations. It is at least 31 for internal
identifiers and 6 for external identifiers in C90, and higher
than that in each case for C99.

I don't know what a "lakh" is.
--
char a[]="\n .CJacehknorstu";int putchar(int);int main(void){unsigned long b[]
={0x67dffdff,0x9aa9aa6a,0xa77ffda9,0x7da6aa6a,0xa6 7f6aaa,0xaa9aa9f6,0x11f6},*p
=b,i=24;for(;p+=!*p;*p/=4)switch(0[p]&3)case 0:{return 0;for(p--;i--;i--)case+
2:{i++;if(i)break;else default:continue;if(0)case 1:putchar(a[i&15]);break;}}}
Dec 14 '07 #3
Ben Pfaff wrote:
lak <la*@nospam.invalidwrites:
>I want to know what is the variable length in c.
I K&R they stated that atleast 31 character.
But I give 1 lakhs length to a variable, but my compiler doesn't say
any error.

The number of significant characters in an identifier varies
among implementations. It is at least 31 for internal
identifiers and 6 for external identifiers in C90, and higher
than that in each case for C99.

I don't know what a "lakh" is.
1E5, or GIYF.

--
Eric Sosman
es*****@ieee-dot-org.invalid
Dec 14 '07 #4
Ben Pfaff said:
lak <la*@nospam.invalidwrites:
>I want to know what is the variable length in c.
I K&R they stated that atleast 31 character.
But I give 1 lakhs length to a variable, but my compiler doesn't say
any error.

The number of significant characters in an identifier varies
among implementations. It is at least 31 for internal
identifiers and 6 for external identifiers in C90, and higher
than that in each case for C99.

I don't know what a "lakh" is.
According to Chambers Dictionary, it's 100,000.

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Dec 14 '07 #5
Ben Pfaff wrote:
lak <la*@nospam.invalidwrites:
But I give 1 lakhs length to a variable, but my compiler doesn't say
any error.
I don't know what a "lakh" is.

It was a surprise to me to find it in Merriam-Webster online:

<http://m-w.com/dictionary/lakh>


Brian
Dec 14 '07 #6
Eric Sosman wrote:
Ben Pfaff wrote:
>lak <la*@nospam.invalidwrites:
>>I want to know what is the variable length in c.
I K&R they stated that atleast 31 character.
But I give 1 lakhs length to a variable, but my compiler doesn't
say any error.

The number of significant characters in an identifier varies
among implementations. It is at least 31 for internal
identifiers and 6 for external identifiers in C90, and higher
than that in each case for C99.

I don't know what a "lakh" is.

1E5, or GIYF.
Around here it is assumed to be a hairy ruminant cloven-hoofed
moss-eating cold-weather animal, with an evil taste. :-)
(Endangered specied)

--
Chuck F (cbfalconer at maineline dot net)
<http://cbfalconer.home.att.net>
Try the download section.

--
Posted via a free Usenet account from http://www.teranews.com

Dec 15 '07 #7
On Fri, 14 Dec 2007 15:07:02 -0800, Ben Pfaff <bl*@cs.stanford.edu>
wrote:
>lak <la*@nospam.invalidwrites:
>I want to know what is the variable length in c.
I K&R they stated that atleast 31 character.
But I give 1 lakhs length to a variable, but my compiler doesn't say
any error.

The number of significant characters in an identifier varies
among implementations. It is at least 31 for internal
identifiers and 6 for external identifiers in C90, and higher
than that in each case for C99.
So, if I declared functions with external linkage like the following
in C90, then the behavior would be undefined, right?

void *avl_t_first (struct avl_traverser *, struct avl_table *);
void *avl_t_find (struct avl_traverser *, struct avl_table *, void *);

I'm using a C90 compiler.

If I use such code, could it format my hard drive?
If I use such code, could it cause WWIII?
If I use such code, on the Deathstation 9000, could it cause demons to
fly out of my nose?
If I use such code, could it cause Scott Nudds to come flying out of
my nose?
If I use such code, could it <insert your favorite consequence of
undefined behavior here>?

--
jay
Dec 15 '07 #8
lak wrote:
Hello firends.
I want to know what is the variable length in c.
I K&R they stated that atleast 31 character.
But I give 1 lakhs length to a variable, but my compiler doesn't say
any error.
It accepts it.Then what is the maximum length to a variable.?
You asked this same question some time back. Couldn't you be bothered to
read the answers then given to you?

Dec 15 '07 #9
jaysome <ja*****@hotmail.comwrites:
So, if I declared functions with external linkage like the following
in C90, then the behavior would be undefined, right?

void *avl_t_first (struct avl_traverser *, struct avl_table *);
void *avl_t_find (struct avl_traverser *, struct avl_table *, void *);

I'm using a C90 compiler.
Much code assumes that more than 6 characters are significant in
external identifiers.
--
Ben Pfaff
http://benpfaff.org
Dec 15 '07 #10
On Dec 14, 11:14 pm, Eric Sosman <esos...@ieee-dot-org.invalidwrote:
Ben Pfaff wrote:
lak <l...@nospam.invalidwrites:
I want to know what is the variable length in c.
I K&R they stated that atleast 31 character.
But I give 1 lakhs length to a variable, but my compiler doesn't say
any error.
The number of significant characters in an identifier varies
among implementations. It is at least 31 for internal
identifiers and 6 for external identifiers in C90, and higher
than that in each case for C99.
I don't know what a "lakh" is.

1E5, or GIYF.
In that case I'd advise the OP against using name of this length for
his variables - it might make his code hard to read, and the danger of
typos would be non-negligible. :)
>
--
Eric Sosman
esos...@ieee-dot-org.invalid
Dec 16 '07 #11
Fr************@googlemail.com wrote:
On Dec 14, 11:14 pm, Eric Sosman <esos...@ieee-dot-org.invalidwrote:
>Ben Pfaff wrote:
lak <l...@nospam.invalidwrites:
>I want to know what is the variable length in c.
I K&R they stated that atleast 31 character.
But I give 1 lakhs length to a variable, but my compiler doesn't
say any error.
The number of significant characters in an identifier varies
among implementations. It is at least 31 for internal
identifiers and 6 for external identifiers in C90, and higher
than that in each case for C99.
I don't know what a "lakh" is.

1E5, or GIYF.

In that case I'd advise the OP against using name of this length for
his variables - it might make his code hard to read, and the danger of
typos would be non-negligible. :)
The OP is apparently a troll, as he posted the very same "question" a
while back, and got more than adequate responses. If he isn't a troll,
then, one is forced to the much more distressing conclusion that he is
incapable of learning and comprehension.

Dec 17 '07 #12

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Stefanie | last post by:
Hi, I have a question about declaring variables for writing data to a file for random access. I have two string variables declared in a module (user-defined types). The point is that for one of...
3
by: pauldepstein | last post by:
Sorry in advance if this message sounds imprecise but it's difficult to be precise when you don't really understand what's going on. I have a class called Parameters. The default constructor...
9
by: Daan | last post by:
Say I have an Object of the following class: public class SomeClass { public string var1; public int var2; public SomeType var3; } Now I want to print all the three vars. Is it possible to...
17
by: lm401 | last post by:
I'm trying to work with the following idea: class animal: def __init__(self, weight, colour): self.weight = weight self.colour = colour class bird(animal): def __init__(self, wingspan):
2
by: Frank Swarbrick | last post by:
I'm just learning about embedded SQL, so be gentle... My basic question is, if I use a fixed length host variable for a column defined as VARCHAR, will trailing spaces be removed (or not) upon...
7
by: misha | last post by:
Hello. I was wandering if someone could explain to me (or point to some manual) the process of mapping the addresses of host variables by DB2. Especially I would like to know when DB2 decides to...
28
by: Nutkin | last post by:
Basicly i have to make a program that calculates the distance between x and y points in 2d space. the code basicly goes like this 1. User says how many points they have (max of 10) 2. User...
2
by: justplain.kzn | last post by:
Hi, I have a table with dynamic html that contains drop down select lists and readonly text boxes. Dynamic calculations are done on change of a value in one of the drop down select lists. ...
58
by: Jorge Peixoto de Morais Neto | last post by:
I was reading the code of FFmpeg and it seems that they use malloc just too much. The problems and dangers of malloc are widely known. Malloc also has some overhead (although I don't know what is...
6
KevinADC
by: KevinADC | last post by:
This snippet of code provides several examples of programming techniques that can be applied to most programs. using hashes to create unique results static variable recursive function...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.