Home Accessibility Courses Twitter The Mouth Facebook Resources Site Map About Us Contact
 
For 2023 (and 2024 ...) - we are now fully retired from IT training.
We have made many, many friends over 25 years of teaching about Python, Tcl, Perl, PHP, Lua, Java, C and C++ - and MySQL, Linux and Solaris/SunOS too. Our training notes are now very much out of date, but due to upward compatability most of our examples remain operational and even relevant ad you are welcome to make us if them "as seen" and at your own risk.

Lisa and I (Graham) now live in what was our training centre in Melksham - happy to meet with former delegates here - but do check ahead before coming round. We are far from inactive - rather, enjoying the times that we are retired but still healthy enough in mind and body to be active!

I am also active in many other area and still look after a lot of web sites - you can find an index ((here))
What is an lvalue? (Perl, C)

An lvalue is an expression that you can write on the left hand side of an assignment statement - in other words an expression that defines a specific memory address of a variable.

The most common lvalues are simple variables or array / list / hash / dictionary members ... for example

$hello = "Hello World";
$greet[5] = "Hello World";
$greet{"UK"} = "Hello World"; # all these in Perl


val = 15;
jolly[posn] = 27; # These two in C


There are some surprises until you think about it.

In Perl you can write $lhs[$n+4] = 17; but not $lhs+4 = 17;. Yet in C, if vvv is a pointer to an array you can write vvv+4 = 15; quite happily - altering the fifth element of the array.

You'll find the term lvalue come up most usually for the programmer in a compiler error message - "invalid lvalue" you will be told. What the compiler really means is that the twit who wrote the code is trying to save a value into an expression that doesn't actually define the memory address of a variable.
(written 2008-03-18)

 
Associated topics are indexed as below, or enter http://melksh.am/nnnn for individual articles
P301 - Variables in Perl
  [975] Answering ALL the delegate's Perl questions - (2006-12-09)
  [1946] Variable Types in Perl - (2008-12-15)
  [2241] Perl references - $$var and \$var notations - (2009-06-15)
  [2374] Lead characters on Perl variable names - (2009-08-24)
  [2877] Further more advanced Perl examples - (2010-07-19)
  [2972] Some more advanced Perl examples from a recent course - (2010-09-27)
  [3059] Object Orientation in an hour and other Perl Lectures - (2010-11-18)
  [3430] Sigils - the characters on the start of variable names in Perl, Ruby and Fortran - (2011-09-10)
  [4398] Accessing variables across subroutine boundaries - Perl, Python, Java and Tcl - (2015-01-18)
  [4608] Introspecion in Perl 6 - (2016-01-02)

C212 - C and C based languages - Memory Management
  [1497] Training Season Starts again! - (2008-01-07)
  [1589] Dynamic Memory Allocation in C - calloc, realloc - (2008-03-22)
  [1670] Dynamic Memory Allocation in C - (2008-06-09)
  [1845] Passing a table from Lua into C - (2008-10-18)
  [2669] Efficient use of dynamic memory - C and realloc - (2010-03-10)
  [2848] C course - final course example puts it all together - (2010-07-02)
  [3118] Arrays of arrays - or 2D arrays. How to program tables. - (2011-01-02)
  [3144] Setting up arrays in C - fixed size at compile time, or dynamic - (2011-01-24)
  [3386] Adding the pieces together to make a complete language - C - (2011-08-11)
  [3416] Storing Tcl source code encoded, and running via your own C program - (2011-09-02)
  [4128] Allocating memory dynamically in a static language like C - (2013-06-30)
  [4340] Simple C structs - building up to full, dynamic example - (2014-12-03)
  [4634] Regression testing - via a very short C testing framework - (2016-01-29)
  [4635] Encapsulating logic in functions and structs - the C approach to Object Oriented techniques - (2016-01-30)


Back to
Congratulations, Martin and Marta
Previous and next
or
Horse's mouth home
Forward to
Ruby, C, Java and more - getting out of loops
Some other Articles
Well House Consultants / Manor - Staff
Using Structs and Unions together effectively in C
Businesses in West Wiltshire - networking
Ruby, C, Java and more - getting out of loops
What is an lvalue? (Perl, C)
Congratulations, Martin and Marta
Rome, and the faith of Rome
Please don't shout at me!
Spring and early summer training courses
Making PHP and MySQL training relevant to the course delegates
4759 posts, page by page
Link to page ... 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96 at 50 posts per page


This is a page archived from The Horse's Mouth at http://www.wellho.net/horse/ - the diary and writings of Graham Ellis. Every attempt was made to provide current information at the time the page was written, but things do move forward in our business - new software releases, price changes, new techniques. Please check back via our main site for current courses, prices, versions, etc - any mention of a price in "The Horse's Mouth" cannot be taken as an offer to supply at that price.

Link to Ezine home page (for reading).
Link to Blogging home page (to add comments).

You can Add a comment or ranking to this page

© WELL HOUSE CONSULTANTS LTD., 2024: 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho

PAGE: http://www.wellho.net/mouth/1581_Wha ... rl-C-.html • PAGE BUILT: Sun Oct 11 16:07:41 2020 • BUILD SYSTEM: JelliaJamb