Это массив Указателя. Ибо если написать
Тогда не работает. А так хоть одна ошибка.
Зачем было вводить этот массив?
Почему здесь просто login, почему без Амперсанта?
case 1:loginANDpassword(char* login, char* password);
I have created the following program which allows a user to guess a word 3 times before ending the program. I’m using a function to read the users input. When I compile the program I get the error ‘expected expression before char’. Some feedback would be great thanks!


2 Answers 2
You have an extra char here:
Just get rid of it. You just need to pass the variable in.
EDIT :
The other problem seems to be this function:
change it to this:
and it should work. However, be aware that you run the risk of overrunning your guess array.

Inside the loop, write
In addition, you should delete the useless prototype
and change the following function’s signature to
to let a pointer to the first char of the array be passed instead of a pointer to a pointer to the first char which will not compile. A side issue is that char *guess[10] means an array of 10 pointers to char.
PS: It helps to post the offending line number in addition to the error message.
PPS: You have a buffer overrun memory error if the use enters long answers. You can use fgets to avoid this.
So I have this program that reads scores and students names from another file and test scores and prints the average in another file, then assigns a grade to each average score and prints the student’s name, average score, and grade.
Everything is alright, except I can’t compile it because of the lines that say «char grade = *whatever letter is there*»
All of the lines like that receive the error «expected expression before ‘char'»
So I tried to change the first one to this:
but now I am receiving the error «invalid initializer»
Can anyone help me? I don’t know what to do.
char line[121], name[81], surname[81], grade[81], F[20], D[20], C[2
double score1, score2, score3, score4, score5, sum, ave;
FILE *SCORES, *OUTGRADES;
SCORES = fopen(«score.dat», «r»);
OUTGRADES = fopen(«grades.dat», «w»);
while(fgets(line, 121, SCORES) != NULL)
sscanf(line, «%lf %lf %lf %lf %lf», &score1, &score
sum = score1 + score2 + score3 + score4 + score5;
if (ave =50 && ave =62 && ave =82 && ave =90 && ave Update :
Thank you for your insight (it was very clearly explained), but you see what you told me to do that’s what I did at first, and the first time my program compiled but the error I got was a Segmentation Fault (core dumped). So when I was trying to fix the first error, that’s when I created all that stupid declarations and whatnot which didn’t even let my program compile.
This is what I wrote at first and what you told me to write. Do you know why there would be a Segmentation Fault from this?
char line[121], name[81], surname[81], grade, F, D, C, B, A, S;
double score1, score2, score3, score4, score5, sum, ave;