Simple doubt related to strings in C (question in an interview)
Posted
by piemesons
on Stack Overflow
See other posts from Stack Overflow
or by piemesons
Published on 2010-05-21T18:17:17Z
Indexed on
2010/05/21
18:30 UTC
Read the original article
Hit count: 203
c
// The first example:
char text[] = "henri";
char *p;
p = text;
*(p + 1) = 'E'; // Output = hEnri
// Now If we want to remove the "e" ie hnri, we would go for?????
*(p + 1)=?????
Please dont say start copying the array. I am looking for the best solution. Its an interview question...
EDIT
I specially mentioned the question that i am not asking for the solution like start moving the element. I thought there must be some other good solution..
© Stack Overflow or respective owner