CoolInterview.com - World's Largest Collection of Interview Questions
 Interview Questions  
 Our Services  

Get 9,000 Interview Questions & Answers in an eBook.


  • 9500+ Pages
  • 9000 Question & Answers
  • All Tech. Categories
  • 14 MB Content

    Get it now !!


    Send your Resume to 6000 Companies


  • INTERVIEW QUESTIONS LANGUAGES C DETAILS
    Question :
    Array is an lvalue or not?
    Category C Interview Questions
    Rating (4.0) By 5 users
    Added on 10/22/2004
    Views 4603
    Rate it!
    Answers:

    An lvalue was defined as an expression to which a value can be assigned. Is an array an expression
    to which we can assign a value? The answer to this question is no, because an array is composed of several separate array elements that cannot be treated as a whole for assignment purposes.

    The following statement is therefore illegal:

    int x[5], y[5];
    x = y;

    Additionally, you might want to copy the whole array all at once. You can do so using a library function such as the memcpy() function, which is shown here:

    memcpy(x, y, sizeof(y));

    It should be noted here that unlike arrays, structures can be treated as lvalues. Thus, you can assign one structure variable to another structure variable of the same type, such as this:

    typedef struct t_name
    {
    char last_name[25];
    char first_name[15];
    char middle_init[2];
    } NAME;
    ...
    NAME my_name, your_name;
    ...
    your_name = my_name;
    ...





    If you have the better answer, then send it to us. We will display your answer after the approval.
    Name :*
    Email Id :*
    Answer :*
    Verification Code Code Image - Please contact webmaster if you have problems seeing this image code Not readable? Load New Code
    Process Verification  Enter the above shown code:*
    Inform me about updated answers to this question

       
    Related Questions
    View Answer
    What is page thrashing?
    View Answer
    What is a const pointer?
    View Answer
    When should the register modifier be used? Does it really help?
    View Answer
    when should the volatile modifier be used?
    View Answer
    Can a variable be both const and volatile?
    View Answer
    How reliable are floating-point comparisons?
    View Answer
    How can you determine the maximum value that a numeric variable can hold?
    View Answer
    When should a type cast be used?
    View Answer
    When should a type cast not be used?
    View Answer
    Is it acceptable to declare/define a variable in a C header?
    View Answer

    Please Note: We keep on updating better answers to this site. Subscribe to our newsletter to get notified when better answer is posted.

    Notify me when better answer is posted!
    Email:

    View ALL C Interview Questions

    User Options
    Sponsored Links


    Copyright ©2003-2009 CoolInterview.com, All Rights Reserved.
    Privacy Policy | Terms and Conditions
    Page URL: http://www.coolinterview.com/interview/1062/default.asp?cachecommand=bypass


    Download Yahoo Messenger | Placement Papers| FREE SMS | ASP .Net Tutorial | Web Hosting | Dedicated Servers | Joke of the Day

    0.42