Hi there,
I was wondering if anyone could explain to me the difference between an imperative program, and an OO program?
I am fully aware of the languages which support these (older languages for imperative, and for example Java for OO), and although I understand the basic concepts of OO - classes and objects, I would just like some clarification of the difference between OO and imperative.
At present, I am...
User Profile
Collapse
-
Imperative programming Vs Object Oriented programming
-
You are exactly correct - and I have now done this, and all is compiling well! I also fiddled a few other bits... Thank you all for your help!
Now I've gotta figure out how to stick this in a hash table! Eek!! I may be back! -
Howdy!
Thanks for your help there, I understand what you meant, and actually thought it would fix the problem... but it hasn't! :(
The reason I use two methods to read the file, is that I *only* need the surname of the first line, not the first name (it's discarded), thus I must read only up to the comma.
Now it still reads in only 2 records, then hits a segmentation fault. Code is now:
...Leave a comment:
-
Ok - here's the full code:
typedef struct entry {
char *surname;
char *postcode;
char *full_address;
} Entry;
/* get returns next file entry, or NULL if end of file*/
Entry *get(FILE *fd)
{
int i;
char addressbuf[MAXLINESIZE];
char postcodebuf[MAXLINESIZE];
char namebuf[MAXLINESIZE];
char ch;
char *firstname;
...Leave a comment:
-
-
C pointer issues... Segmentation fault!
Howdy!
I'm mega confused with all this pointer malarky in C and it's resulting in an ever annoying segmentation fault which just won't go away!
Essentially the program I am building has a Get() function which reads 1 record of data from a file, another function adds this record (or struct) to a data structure, then the Get function reads and returns the next record.
A record consists of a surname, address...
No activity results to display
Show More
Leave a comment: