Hi ,
this one is with respect to C.
(i)
when we use array an array index always starts from zero .
is it a standard one? or compilers are implemented that way?
if compilers are implented that way they must have followed some standard.
(ii)
the array name cannot be changed is it the standard or compiler dependent.

i have never heard that array index starts from 1 and base address can be changed.

Thanks,
Danian

>>is it a standard one?
Yes -- all compilers are required to implement it like that. Here is info about ansi c standards

>>the array name cannot be changed is it the standard or compiler dependent.
Standard -- its impossible to change the name of an object once it has been instantiated.

You can pass the value to another function - and name the variable something else. But you are not gaining anything by doing that.

void refoo(int newname)
{
    printf("variable newname=%d\n", newname);
}

void foo(void)
{
    int oldname=13;
    printf(" variable oldname=%d\n", oldname);
    refoo(oldname);
}

As long the variable is in scope the name does not/ cannot change. oldname has function scope in the example above.

You can pass the value to another function - and name the variable something else. But you are not gaining anything by doing that.

void refoo(int newname)
{
    printf("variable newname=%d\n", newname);
}

void foo(void)
{
    int oldname=13;
    printf(" variable oldname=%d\n", oldname);
    refoo(oldname);
}

As long the variable is in scope the name does not/ cannot change. oldname has function scope in the example above.

jim mcnamara
i dont understand how that is related to my question, can you eloborate a little please..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.