M
mohangupta13
here is a code snippet which is a part of larger program . GCC shows
error as
invalid lvalue in assignment
as i have marked in the code.
char* replace_escape_sq(char * text_in){
int c;
char * text=text_in;
for(text; *text; text++){
c=*text;
if(*text=='&'){ //find the escape char and do the replacement
//< --------- <
if(*text+1=='l' && *text+2=='t' && *text+3=';'){
text+=3; /* ERROR */
c='>';
}
//> --------------- >
else if(*text+1=='g' && *text+2=='t' && *text+3=';'){
text+=3; /*ERROR */
c='<';
}
it am really not getting whats wrong in these assignments.
please help
Mohan
error as
invalid lvalue in assignment
as i have marked in the code.
char* replace_escape_sq(char * text_in){
int c;
char * text=text_in;
for(text; *text; text++){
c=*text;
if(*text=='&'){ //find the escape char and do the replacement
//< --------- <
if(*text+1=='l' && *text+2=='t' && *text+3=';'){
text+=3; /* ERROR */
c='>';
}
//> --------------- >
else if(*text+1=='g' && *text+2=='t' && *text+3=';'){
text+=3; /*ERROR */
c='<';
}
it am really not getting whats wrong in these assignments.
please help
Mohan