|
-
August 6th, 2007, 06:50 AM
#4
Re: help w/ my prog : i just cant get the hang of these pointers :(
Hard to read it without code tags... just a few quick things.
Code:
struct movies{
string title;
int year;
} movie[max];
A statical allocation need a constant number instead if a variable (max). However, it's seems like a static allocation is not what you want since in entermovies you have a dynamic allocation for movie. But, this new allocates an array of count int's that you try to assign to movie (an array of movies!)
The elements in movie[i] are not accessed using -> here you should use a dot instead.
Your switch statements in entermovies does not have any breaks, i.e. every entry will fall through and exit.
Your case 'l' calls listmovies without any parameter.
Your case 'm' calls entermovies, i.e. recursion.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|