|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
hello i put this code in the compiler (Dev-C++ 4.0):
PHP Code:
and i get a **** load of errors like: 35 test22.cpp parse error before `{' 36 test22.cpp parse error before `)' then i just get a lot of sntax errors like 40 test22.cpp syntax error before `<=' if i take out the read fuction and the calling of the read function it all compiles fine.. could someone please help me figure out what im doing rong.. thanks, Jordan |
|
#2
|
||||
|
||||
|
You can't declare one function within another in C. That's the problem. You'd have to declare read() outside main(). Since read() accesses an array, you can either
(a) declare the array as a global (b) modify the read() function to accept an array pointer as a parameter. Hope this helps ![]() |
|
#3
|
||||
|
||||
|
On a different note, square should actually be defined as char square[26], instead of char square[25].
__________________
"A poor programmer is he who blames his tools." http://analyser.oli.tudelft.nl/ |
|
#4
|
|||
|
|||
|
char sSquare[27];//extra space for the '\0'
sprintf(sSquare,"abcde...........xyz");
__________________
The essence of Christianity is told us in the Garden of Eden history. The fruit that was forbidden was on the Tree of Knowledge. The subtext is, All the suffering you have is because you wanted to find out what was going on. You could be in the Garden of Eden if you had just kept your f***ing mouth shut and hadn't asked any questions. Frank Zappa |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > C Programming > Array with functions |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|