I want the output to be XOllo, but segfault is what I am getting.
#include <stdio.h>
#include <string.h>
int main(){
  char *buf="hello";
  char *xys="XO";
  while(*buf != 'l'){
  *buf = *xys;
  xys++;
  buf++;
  }
  printf("%s \n", buf);
  return 0;
}
o/p-: segfault
I need the o/p as XOllo, but I get seg fault. Please suggest.
Please suggest. 
 
     
    