I was working on an assignment and noticed I was getting a Seg Fault when I tried printing the individual characters of a string. This is strange because there is no segmentation fault when I remove the print statement.
I simplified that part of the assignment that gave me the Seg Fault in a simpler code.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
void printword( char **sptr){
    int i;
    for( i = 0; i < 6; ++i){
        printf( "%c\n", *sptr[i]);
    }
}
int main(){
    char *sentence = "This is my sentence\n";
    printf("Sentence is: %s", sentence);
    printword( &sentence );
}
When I run this code, Only the first letter prints, then right after a '?' followed by 'Segmentation fault: 11'. It seems that I can print any character from the string, however, just 1 character is my limit before a seg fault. I don't understand why this is an issue because I am simply printing.
char**?().Cyou pass double pointer when accessing you pass single pointer. Just the side not.strcpy,strtok,strcat, etc. don't do that.