fork download
  1. #include <stdio.h>
  2. int main() {
  3. char list[] = "22QPP1";
  4. const char *pa, *pb;
  5. char *pc, *pd;
  6. pa = &list[1];
  7. list[2] = 'K';
  8. pb = &list[3];
  9. pc = list;
  10. pd = strstr(pa, pb);
  11. printf("pd: %s \n", pd);
  12. if (pd != 0) {
  13. strncpy(pd, "77", 3);
  14. printf("pc: %s \n", pc);
  15. }
  16. printf("pb: %s \n", pb);
  17. return 0;
  18. }
Success #stdin #stdout 0s 5296KB
stdin
Standard input is empty
stdout
pd: PP1 
pc: 22K77 
pb: 77