Hello in this code gives me an error when I ask the user to enter a string and modify the one that I already entered that is "dog", the problem is in these lines
printf("Ingrese una palabra: ");
scanf("%s",(vector+1));
If I do not use them, it works well, but I want the user to be able to modify that "dog" that I gave.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
int i,j,a;
char **vector;
vector = (char**)malloc(2*sizeof(char*));
*(vector) = "hola";
*(vector + 1) = "perro";
printf("Ingrese una palabra: ");
scanf("%s",(vector+1));
puts("\nImprimiendo caracter a caracter:");
for(i=0;i<2;i++)
{
for(j=0; j<strlen(*(vector+i)) ; j++)
{
printf("%c",*(*(vector+i)+j));
}
puts("");
}
puts("\nImprimiendo completo:");
printf("%s\n",*vector);
printf("%s",*(vector+1));
free(vector);
return 0;
}