473,508 Members | 2,295 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

error: invalid lvalue in assignment

1 New Member
Hi,

I keep getting two invalid lvalue in assignment errors. here's what my code looks like:

Expand|Select|Wrap|Line Numbers
  1. pthread_t msg_receive(char *sbuffer, int *maxlen) {
  2.     // get the values for sbuffer and maxlen
  3.  
  4.     strcpy(sbuffer, current->message);
  5.     &maxlen = current->messagelen;      // invalid lvalue here
  6. }
  7.  
current is a struct ptr with these attributes:
Expand|Select|Wrap|Line Numbers
  1. current {
  2.     char *message;
  3.     int messagelen;
  4.     char *replymsg;
  5.     int replylen;
  6. }
the other place i'm getting the lvalue error is basically the same. me trying to deference an int to assign it a value from a struct.

I'd really appreciate if someone can tell me what i've done wrong.

thanks.
Mar 16 '08 #1
1 3742
Ganon11
3,652 Recognized Expert Specialist
Expand|Select|Wrap|Line Numbers
  1. &maxlen
& is not the de-reference operator, it's the address-of operator. You're using it to find the address of the pointer to an integer. You should be using *, like so:

Expand|Select|Wrap|Line Numbers
  1. *maxlen
Mar 17 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
7310
by: Christopher | last post by:
I have the following errors, can someone explain how I accomplish the pointer assignment here? Error Message : CQueue.cpp: In member function `void cs3358Fall2003::circular_queue::push(const...
19
36625
by: Hongzheng Wang | last post by:
In K&R, they said: An object is a named region of storage; an lvalue is an expression refer to an object. How about these concept in C++? `The C++ Programming Language' has a similar...
9
3521
by: Steven T. Hatton | last post by:
This is from the draft of the previous version of the Standard: http://www.kuzbass.ru:8086/docs/isocpp/expr.html 2- A literal is a primary expression. Its type depends on its form...
8
1438
by: - | last post by:
Hi to All, To reproduce: The expression: object result = flag ? (long) 0 : (double) 0; always evaluated as a double... see dissassembly to ensure the bad compiled code.
1
3375
by: Tapeesh | last post by:
In C++, why does assignment operator always return a lvalue. Even in cases of assignment of basic datatypes like int ? For eg. int main() { int a, b, c; a = b + c; return 0;
6
4114
by: Paul Edwards | last post by:
The following code: int main(void) { char *x; (void **)x += 1; return (0); }
22
3587
by: clicwar | last post by:
A simple program with operator overloading and copy constructor: #include <iostream> #include <string> using namespace std; class Vector { private: float x,y; public: Vector(float u, float...
17
366
by: somenath | last post by:
Hi ALL, I have one doubt regarding the compilation error for the bellow mentioned code. #include<stdio.h> int main(void) { int a =5,b=0; a>5?b=3:b=5;
11
2483
by: markryde | last post by:
Hello, Followed here is a simplified code example of something which I try to implement; in essence , I want to assign a value to a return value of a method is C. I know, of course, that in this...
0
7228
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7393
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7058
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7502
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5635
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
3206
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1565
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
769
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
426
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.