define two functions

This is a discussion on define two functions within the C Programming forums, part of the General Programming Boards category; Given that: Code: typedef struct node { char *title; char *ISBN[10]; struct book *next; } insert_queue; How do i write ...

  1. #1
    Registered User
    Join Date
    Oct 2008
    Posts
    6

    define two functions

    Given that:

    Code:
    typedef struct node {
    char *title;
    char *ISBN[10];
    struct book *next;
    } insert_queue;
    How do i write a function:
    void title_insert (insert_queue **front, insert_queue **rear, char *name, char *ISBN[]) such that *front point to the 1st node, *rear point to the last node. It will insert a new node with title and ISBN at the end of queue and update front and rear.

    Thanks all.

  2. #2
    a_capitalist_story
    Join Date
    Dec 2007
    Posts
    2,649
    You're a little slow aren't you? Haven't picked up yet that we don't do people's homework for them?

  3. #3
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,452
    When did books start having 10 ISBN numbers?

    Start by drawing some diagrams of a list on paper.

    What does the list look like when it's empty.

    How do you add a node to an empty list, think about the operations you perform.

    Then model adding a node to a list with 1 element (see previous).

    Repeat until you get some idea of what special cases there may be (say adding a node to an empty list), or what might be general.

    Then have a go at expressing your ideas in code.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  4. #4
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    Quote Originally Posted by Salem View Post
    When did books start having 10 ISBN numbers?
    I was under the impression that books have 13 ISBN-10 numbers. Right?

  5. #5
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,185
    Quote Originally Posted by master5001 View Post
    I was under the impression that books have 13 ISBN-10 numbers. Right?
    13 characters, yes. But of course that would be char ISBN[13], not char *ISBN[13].

  6. #6
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    Wow... tough crowd tonight. Perhaps this can shed some light on my previous post.

  7. #7
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,185
    If I was sure the OP had already seen the difference, I wouldn't have bothered.

  8. #8
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    Ah yes. Well I will quietly climb off my soap box and sit down in the back corner of the room...

  9. #9
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Actually, old-style ISBN is 10 digits. Modern ISBN is 13 digits (because the old style ones ran out).

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  10. #10
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,452
    And it annoys me how some tend to use ISBN-10 and some ISBN-13 and some sites only accept / recognize ISBN-13... Gah >_<
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  11. #11
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    Pobrecita. Perhaps you can send them a nasty email in protest.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Why?!?
    By p3rry in forum C Programming
    Replies: 3
    Last Post: 01-08-2009, 11:52 AM
  2. Implenting Function Keys
    By frassunit in forum C Programming
    Replies: 14
    Last Post: 11-12-2008, 10:31 AM
  3. size of an integer pointer
    By onebrother in forum C Programming
    Replies: 5
    Last Post: 07-09-2008, 11:49 AM
  4. Would someone solve my problem?
    By Lonners in forum C Programming
    Replies: 9
    Last Post: 01-19-2008, 05:58 PM
  5. whats wrong here
    By sreetvert83 in forum C++ Programming
    Replies: 15
    Last Post: 09-21-2005, 10:05 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21