Lvalue Required Error In C
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site lvalue required string About Us Learn more about Stack Overflow the company Business Learn more about lvalue required in function main hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss
How To Remove Lvalue Required Error In C++
Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Lvalue required error http://ieng9.ucsd.edu/~cs30x/Lvalues%20and%20Rvalues.htm TurboC up vote -1 down vote favorite char activity[30]; int choice; scanf("%d", &choice); if(choice==1){ activity = "Sedentary"; } else if(choice==2){ activity = "Light Activity"; } else if(choice==3){ activity = "Moderate Activity"; } else if(choice==4){ activity = "Very Active"; } else if(choice==5){ activity = "Extra Active"; } When I compiled, it shows lvalue required error. I don't know what it means, can someone help me. Sorry http://stackoverflow.com/questions/19681948/lvalue-required-error-turboc about my English. Edited - title TurboC (typo) c share|improve this question edited Oct 30 '13 at 12:21 asked Oct 30 '13 at 12:13 nyc2x 137 C# or C? C# doesn't have scanf –Jeroen Vannevel Oct 30 '13 at 12:15 Also in C#, it's string activity and not char activity[30] –Benoit Blanchon Oct 30 '13 at 12:16 Is there even a Turbo C# product? Do you mean Turbo C or Turbo C++? If it is either of those, the compilers are going to be very out of date, and you should find a newer compiler to work with to learn the language. –crashmstr Oct 30 '13 at 12:16 1 It's really going to help you if you know what language you are coding in. I suggest that you step back and get a better grip on what you are doing. –David Heffernan Oct 30 '13 at 12:19 @JeroenVannevel i'm sorry about the title typo ._. –nyc2x Oct 30 '13 at 12:25 | show 3 more comments 2 Answers 2 active oldest votes up vote 1 down vote accepted In C, you must use strcpy()
Programming Boards C Programming Lvalue required error Getting started with C or C++ | C Tutorial | C++ Tutorial | C and C++ FAQ | Get a compiler | http://cboard.cprogramming.com/c-programming/110763-lvalue-required-error.html Fixes for common problems Thread: Lvalue required error Thread Tools Show Printable Version Email this Page… Subscribe to this Thread… Display Linear Mode Switch to Hybrid Mode Switch to Threaded Mode 01-03-2009 #1 eklavya8 View http://ieng9.ucsd.edu/~cs30x/Lvalues%20and%20Rvalues.htm Profile View Forum Posts Registered User Join Date Jan 2008 Posts 30 Lvalue required error when do we get an lvalue required error and an rvalue required error. 01-03-2009 #2 Adak View Profile View Forum error in Posts Registered User Join Date Sep 2006 Posts 8,868 When you're damn unlucky! 01-03-2009 #3 root4 View Profile View Forum Posts Registered User Join Date Apr 2008 Posts 396 if you try 5=5 you get an 'invalid lvalue in assignment'-like error, is it what you mean? it happens when the left side of an assignement is not...assignable (i.e. a variable). I don't see any situation in which you would get error in c the equivalent for an rvalue, as it would rather result in a syntax error... What was the point of the question? any context? 01-03-2009 #4 tabstop View Profile View Forum Posts and the Hat of Guessing Join Date Nov 2007 Posts 14,185 A (modifiable) lvalue is required for assignment. If you have this = that; then this has to be an lvalue. There are no such things as rvalues in C, although sometimes people use it to mean "something that could be on the right-hand side of a assignment". 01-03-2009 #5 eklavya8 View Profile View Forum Posts Registered User Join Date Jan 2008 Posts 30 Originally Posted by root4 if you try 5=5 you get an 'invalid lvalue in assignment'-like error, is it what you mean? it happens when the left side of an assignement is not...assignable (i.e. a variable). I don't see any situation in which you would get the equivalent for an rvalue, as it would rather result in a syntax error... What was the point of the question? any context? Code: int a[]={1,5,6,8}; for(int j=0;j<5;j++) { printf("%d",*a); a++; } gives this error,ny idea why? 01-03-2009 #6 tabstop View Profile View Forum Posts and the Hat of Guessing Join Date Nov 2007 Posts 14,185 Originally Posted