Hey its me again i dunno this string stuff gonna drive me insane really been doing since yesterday exercises on string did half of them but i have this program which should remove chars that i specify and when i test with putchar it does remove them but The string itself didnt !!!
#include <stdio.h>
#include <string.h>
int RemoveChars(char *S,char c) {
int i=0;
int spaces=0;
char temp;
for(i=0;S[i]!=0;i++) {
temp=S[i];
if(S[i]!=c) {
S[i]=temp;
putchar(temp);//this totally works !!!!!!
}
else
spaces++;
}
return spaces;
}
int main(void)
{
char name[]="dude and duder";
int spaces;
spaces=RemoveChars(name,' ');
printf("Now after its Changed its %s and there was %d spaces\n",name,spaces);//What the Hell why doesnt it WORK !!!!!!!
return 0;
}