|
|
View previous topic :: View next topic |
Author |
Message |
mle Guest
|
"LVALUE required" |
Posted: Thu Jun 26, 2003 7:36 am |
|
|
Hello,
I have the following code in my main program:
void main(){
char line1[25], seconds[3], colon[2];
.
.
.
sprintf(colon,"\%c",':');
line1=strcat(seconds,colon); //ERROR HERE
.
.
}
I get an error on the 'strcat' line that says "LVALUE required".
What am I doing wrong?
Thanks,
mle
___________________________
This message was ported from CCS's old forum
Original Post ID: 144515574 |
|
|
R.J.Hamlett Guest
|
Re: "LVALUE required" |
Posted: Thu Jun 26, 2003 7:47 am |
|
|
:=Hello,
:=I have the following code in my main program:
:=
:=void main(){
:=char line1[25], seconds[3], colon[2];
:=.
:=.
:=.
:=sprintf(colon,"\%c",':');
:=line1=strcat(seconds,colon); //ERROR HERE
:=.
:=.
:=}
:=
:=
:=I get an error on the 'strcat' line that says "LVALUE required".
:=What am I doing wrong?
:=
:=Thanks,
:=mle
'LVALUE required', implies that a value type is wrong. The fault, is that 'strcat', returns a pointer to a string, while line1, is allready defined, as a physical array (not a pointer). Though C allows you to use the name of an array as a pointer for the right hand side of an equation, doing it the other way round won't work.
Change your definition to:
char *line1, seconds[3], colon[2];
Best Wishes
___________________________
This message was ported from CCS's old forum
Original Post ID: 144515575 |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|