String Error "Lvalue required"......?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • abhi821
    New Member
    • Mar 2013
    • 1

    String Error "Lvalue required"......?

    Getting string error on following code:

    Code:
    #include<stdio.h>
    #include<string.h>
    void main()
    {
    char name[20];
    name="Hello";
    printf("%s",name);
    getch();
    }
    Last edited by Rabbit; Mar 18 '13, 04:54 PM. Reason: Please use code tags when posting code.
  • monika5592
    New Member
    • Mar 2013
    • 2

    #2
    sorry buddy
    but c don't allow to put array declaration and array initialization separately.
    so it should be
    Code:
    char name[20]="Hello";

    Comment

    Working...