![]() |
|
#51
|
|||
|
|||
Re: Linked Lists advice requestQuote:
But please go back to simpler example as suggested. Your compiler runs it as it compiles? Will ctrl-c stop it instead of ctrl-alt-del? hmmm Post the entire case 3 including it's 'case' and it's 'break'. sorry, maybe a bad example. The point is that it attempts to assign data outside of the memory space that the OS has allocated for your program. That is a segfault or "segmentation fault" I know what you mean, I get timed out while composing sometimes too... I have to go , but look forward to seeing a single moving shape later! or just as enjoyable, an understandable posting of problems associated to creating that single shape. |
|||
|
#52
|
|||
|
|||
Re: Linked Lists advice request"post"?
I mean, I copied it into the prog in place of the 2-3 that was there including its case and break, and it just spat it out, so I'm just focussing on rebuilding the switch from scratch, and I've deleted everything that's not being used or relevant to get the basic skeleton working. "composing" ! if only i could write code by waggling a chopstick in front of the screen! |
|
#53
|
|||
|
|||
Re: Linked Lists advice requestgettin' 2 persistent errors:
CPP / C++ / C Code:
here: Quote:
|
|
#54
|
|||
|
|||
Re: Linked Lists advice requestunbelievable.... . . . . slow count to 10...100...1000
Your missing two closing braces somewhere in your rediculous 250 line switch to nowhere... don't ask me where they might go , I ain't into wasting my time figuring that mess out... are you done yet??? You are trying to soar while learning to crawl. Ever hear of Icarus? |
|
#55
|
|||
|
|||
Re: Linked Lists advice requestCPP / C++ / C Code:
This is the most basic type of error, they mean a few possible things, missing semicolon, missing bracket , missing inverted commas or missing curly bracket. So it's up to you to go back up and look. Anyone can count the number of brackets and such, you don't need help for that. If you indent your code properly, comment it properly, and implement the big switches and such from WORKING prototypes, you will avoid these problems. (I'm repeating myself, I know) I would suggest you take time to reconstruct your code from ground one reusing all the functions that you know work, won't take long and you will save hours on the long run. And with your brand new knowledge make it in an ordered fashion, put each huge block of code in the switch statements in a separate function switch_func1 2 3... if not the whole of the switch itself. It may seem a waste of time but: 1 your code might become readable and we could help. 2 you will understand what the hell your doing. Naturally the down side is you wont win the OCC contest this year. Good luck. Max |
|
#56
|
|||
|
|||
Re: Linked Lists advice requestI deridiculousised my switch, after getting some sleep.
I knew there was a brace issue. Quote:
|
|
#57
|
|||
|
|||
Re: Linked Lists advice requestSorry if I'm winding people up.
I Rebuilt it. It works. No obvious location for the missing brace(s). So now, I'm trying to add my working line drawing programme into the second level of the switch. Quote:
CPP / C++ / C Code:
cheers, J |
|
#58
|
|||
|
|||
Re: Linked Lists advice requestYo Icarus!
If someone hands you a loaded gun,,, do yourself a favor and give it back. What you posted compiles and runs in g++.... not well though... What your errors came from was obviously different... With -Wall I got 1 warning about menu() having no return value. There is one there so I think the switch is messed. not my problem... To echo Shalombi (thanks dude): On the switch issue: "K&R"-kinda: when you find yourself using a lot of indents and your code is running way off the right side it's probably time to think about using a function for that section... Like for starters, switch2 could go into a menu2(). Any more complex case could go to a separate(). I implore you to remove all extraneous BS: switches, extra structures... and get down to one simple shape. long_shape_type an shape_type are cumbersome names. The structure look looks cumbersome as well. I don't think a one size fit's all approach is a good idea. Design/Define a structure for a particular shape. ONE SHAPE.. like triangle! You asked about where to put variables? - Externally declared variables are available to all functions BUT they should also be redeclared with 'extern' in functions in which they are used. - A variable is only available in the function in which it was declared. (that functions 'SCOPE') - However, the VALUE of a variable may be passed from one function to another. Soak in that a while. |
|
#59
|
|||
|
|||
Re: Linked Lists advice requestNow then Helios,
At last I've found my book on C (it was helpfully tidied away for the last few days by her indoors). I've read some of it and found some useful thoughts on using unions as an element of a structure to try and lose some flabby code, e.g.: CPP / C++ / C Code:
summat along these lines: CPP / C++ / C Code:
The book dun't say owt (=aught) about where to declare the variables, so thanks for this: Quote:
The switch that's there is the same as yours, and it's fine until I started trying to use the data in the structures at the top of the programme within the nested switch cases. I shall slow down now, and hopefully come back with summat less embarrassing... time for some football (the one where the foot comes into regular contact with the ball). cheers again, J |
|
#60
|
|||
|
|||
Re: Linked Lists advice requestHere, this is fixed.... (before you ask where the problems are)
Now just what is the game plan for a union,,, and why would you need both 'data' and 'shape[5]' You already have 5 perfecly good shape structures to work with. You could create as many copies of either of them as you want. CPP / C++ / C Code:
|
Recent GIDBlog
Problems with the Navy (Chiefs) by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| triangle (polygon), drawing, sizing, and rotation programme using linked lists... | promsan | C Programming Language | 12 | 14-May-2007 15:03 |
| Doubly linked lists in C++ | sweeeeeeetlipss | C++ Forum | 1 | 24-Oct-2006 00:27 |
| [Include] Doubly-linked List | dsmith | C Programming Language | 6 | 14-Apr-2006 14:12 |
| help on linked lists any1????? | nick4 | C Programming Language | 1 | 17-May-2004 10:32 |
| linked lists, newbie needs help | moltarim | C Programming Language | 4 | 06-May-2004 12:32 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The