in the following piece of code i want to assign memory to pointer ptr+1 using malloc funcn.
{char *ptr;
ptr ="hello";
ptr+1 = (char *)malloc(sizeof(char));
}
but compiler shows error (Non-lvalue in assignment). what does this error mean?how can i assign memory to pointer to letter e in "hello" i.e. ptr+1 so that i could free that pointer to omit the letter e from "hello" to print "hllo"?
{char *ptr;
ptr ="hello";
ptr+1 = (char *)malloc(sizeof(char));
}
but compiler shows error (Non-lvalue in assignment). what does this error mean?how can i assign memory to pointer to letter e in "hello" i.e. ptr+1 so that i could free that pointer to omit the letter e from "hello" to print "hllo"?