I want to print each element of the array but it generates a segmentation fault
This is the code:
#include <stdio.h>
int main(){
char arreglo[3]={'c','f','d'};
char *puntero;
puntero=arreglo;
for(int i=0;i<3;i++){
puntero+=i;
printf("El valor de puntero es %s \n",*puntero);
}
}
If in printf
instead of putting *puntero
I only put puntero
os so
printf("El valor de puntero es %s \n",puntero);
Print me like this:
cfd
fd
d
I do not know what's wrong.