Hello,

I ultimately want to concatenate two strings using pointers. For some reason I get a segmentation fault as I try to "debug". Can someone tell my why I get this segfault? Thanks!!

Code:
#include <stdio.h>


char* strcopy(char* str_1, char* str_2){
  int idx_2 = 0;
  int idx_1 = 0;
  char* both;
  for (; *(str_1 + idx_1) != '\0'; idx_1++){
    *(both + idx_1) = *(str_1 + idx_1);
  }
  for (; *(str_2 + idx_2) != '\0'; idx_2++){
    *(both + idx_1 + idx_2) = *(str_1 + idx_1 + idx_2);
  }
  *(both + idx_1 + idx_2 + 1) = '\0';


  return both;
}


int main(){


  char *a = "hello";
  char *b = "greetings";


  printf("%s\n", a);


  for (int i = 0; *(a + i) != '\0'; i++){
    *(a + i) = 'b';
  }


  printf("%s\n", a);


  //printf("%s\n", strcopy(a, b);


  return 0;
}