delete(int list)
{
    int i, j, row;
    char temp_last[max], temp_frst[max];

    clrscr();
    gotoxy(1,21);
    printf("Delete Data");
    printf("\n-----------------");
    gotoxy(1,23);
    printf("Last name       : ");
    gets(temp_last);
    gotoxy(1,24);
    printf("First name      : ");
    gets(temp_frst);
    /*for(i=0; i<=list; i++)
    {
        if(stricmp(record[i].last_name, temp_last)==0 && stricmp(record[i].frst_name, temp_frst)==0)
        {
            for(j=i; j<list; j++)
            {
                temp_last=record[j+1].last_name; /*<------Error on this                      .                                                                         line */
                temp_frst=record[j+1].frst_name;
                record[j].last_name=temp_last;
                record[j].frst_name=temp_frst;
            }
            record[j].last_name=NULL;
            record[j].frst_name=NULL; /*<------Up to this*/

        }
    }*/
}

under the comment is where it says Error: Lvalue required in function delete
I dont understand what this means, pls help

Recommended Answers

All 9 Replies

You have to use strcpy() to copy character arrays -- assignment operator doesn't work. strcpy(temp_last,record[j+1].last_name);

in java that assignment operator works but in c using an assignment operator to copy char array to another is an error

Both are right ..
and
U cant use array names on left of the "=" ..
Its actually address of the first momory location allocated for the array not a variable name so u cant change that address .. Thats why the Lvalue error ..

Thanks guys.

Now I jst want to know what that "L" mean?

Location Value

and another is RValue which is Read value..

>Location Value
>and another is RValue which is Read value..

Cute, but no. Your answer conceptually is fine, as it's not technically incorrect, but the question was what the 'L' in lvalue stands for. Historically, lvalue meant the left hand side of an assignment expression while rvalue meant the right hand side. Thus the names are as they are: lvalue means left value and rvalue means right value in the context of an assignment expression.

Standard C takes a slightly different approach in that lvalues are treated as object locators (lvalue can still be a logical derivation). This created the need for a new term due to objects such as arrays or const-qualified objects: modifiable lvalue, which takes on the original meaning. The current state of affairs is as follows:

  • lvalue: an expression with an object type
  • modifiable lvalue: an lvalue that is a complete non-array, non-const type, where all members (in the case of unions and structures) are also non-const.
  • rvalue: The value of an expression.

oh thanks for info..
Our sir also said left and right values but it confuses a bit, Location and read givens more meaning (and CUTE as you said ;-))

seriously its very confusing i believe

It simple dude

Lvalue on left and Rvalue on right ;-)

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.