User Profile

Collapse

Profile Sidebar

Collapse
Cconfused
Cconfused
Last Activity: Jan 15 '08, 01:55 PM
Joined: Oct 31 '07
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • Imperative programming Vs Object Oriented programming

    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...
    See more | Go to post

  • Cconfused
    replied to C pointer issues... Segmentation fault!
    in C
    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!
    See more | Go to post

    Leave a comment:


  • Cconfused
    replied to C pointer issues... Segmentation fault!
    in C
    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:

    ...
    See more | Go to post

    Leave a comment:


  • Cconfused
    replied to C pointer issues... Segmentation fault!
    in C
    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;
    ...
    See more | Go to post
    Last edited by Cconfused; Oct 31 '07, 09:34 PM. Reason: misspelling

    Leave a comment:


  • Cconfused
    replied to C pointer issues... Segmentation fault!
    in C
    I used:

    char postcodebuf[MAXLINESIZE];
    See more | Go to post

    Leave a comment:


  • Cconfused
    started a topic C pointer issues... Segmentation fault!
    in C

    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...
    See more | Go to post
    Last edited by Ganon11; Oct 31 '07, 11:43 PM. Reason: Please use the [CODE] tags provided.
No activity results to display
Show More
Working...