I'm getting a segmentation fault when I try to run my program. It's probably because I'm not referencing my pointer to a string right, or dereferencing whatever it's called. This is basically what my code looks like.
#include <stdio.h>
FILE *myFP;
char filename[20];
char *pstr = finlename;
void func(char *pstr);
int main(void) {
scanf("Enter the filename: %s", &filename);
printf("The name of the file is %s", &pstr);
function(pstr);
}
void func(char *str) {
myFP = fopen(pstr, "r");
}