Discussion: compiler error
Afficher un message
Vieux 06/12/2007, 15h28   #2
Victor Bazarov
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: compiler error

Art Cummings wrote:
> Morning all,
>
> I'm stuck on a compiler error: I've included the entire error and
> the code that is causing it is below. The part of the code that is
> creating
> the error is near the top after main, where I try to initial a member of
> my structural array.


"Try to initial"? No, you are _assigning_ a value to it. At least
that's what you think you're doing. But what value?

> I wanted to be thorough in the information I
> provided.


You didn't say _what_ you "initial" it with.

>
> Thank you
>
> Art Cummings
>
> "studentInfo[x].attendance[i]=''; this is the offending code,
>
>
> Compiler: Default compiler
> Executing g++.exe...
> g++.exe
> "E:\Dekalb\CIS255C\programs\attendanceProg\attenda nce_old.cpp" -o
> "E:\Dekalb\CIS255C\programs\attendanceProg\attenda nce_old.exe" -g3 -I"E:\Boot\Dev-Cpp\lib\gcc\mingw32\3.4.2\include"
> -I"E:\Boot\Dev-Cpp\include\c++\3.4.2\backward" -I"E:\Boot\Dev-Cpp\include\c++\3.4.2\mingw32"
> -I"E:\Boot\Dev-Cpp\include\c++\3.4.2" -I"E:\Boot\Dev-Cpp\include" -L"E:\Boot\Dev-Cpp\lib"
> -g3
> E:\Dekalb\CIS255C\programs\attendanceProg\attendan ce_old.cpp:50:41:
> empty character constant
> [..]


"Empty character constant". What don't you understand? The two
consequent single-quote characters do not represent a valid token in
C++. What do you want to assign to 'studentInfo[x].attendance[i]'?
Nothing? It can't have "nothing" in it. There is no such thing as
"nothing character". If you want to assign something to it, there
has to be something between those apostrophes, or there has to be
no apostrophes at all. You can do

studentInfo[x].attendance[i] = '\0';

or

studentInfo[x].attendance[i] = 0;

(if you want the null character there, for example).

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask


  Réponse avec citation
 
Page generated in 0,05660 seconds with 9 queries