I’m back again with another string problem. I’ve no idea what’s wrong with this. I’m trying to pass a string into a function but GCC expects an expression from me. Help is appreciated. These errors are always so hard to debug!
if (fmenu == 1)
{
printf("\nEnter the file name: \n");
scanf("%s", name);
/* printf("filename: %s", name); */
smenu = sndmenu();
if (smenu !=1 && smenu !=2 )
{
printf("\nIncorrect option\n");
smenu = sndmenu();
if (smenu == 1)
file = fileoperations(name[]); /* Here, I cannot pass name[], expected expression */
}
}
name[]isn’t a valid expression.You need
fileoperations(name);