Structures

This is a discussion on Structures within the C Programming forums, part of the General Programming Boards category; Hey can anyone help me here please... This is a program in c called circbuf.1.c, and i have to draw ...

  1. #1
    Registered User
    Join Date
    Apr 2002
    Posts
    19

    Structures

    Hey can anyone help me here please...

    This is a program in c called circbuf.1.c, and i have to draw a diagram for the following data structure fragment which is executed as follows:

    for (k = 0; k < = 10; k++)
    pushout(buf, '$', &c);
    remchars(buf, 6);


    The details of the functions mentioned above are as follows:
    cheers, atif


    /*******************
    * circbuf.1.h *
    *******************/

    /************************************************** **************
    * *
    * Prototypes for functions operating on buffer. *
    * *
    * Last revised: 03/4/97. Copyright: M. Cook *
    * *
    * init_bufr(n): *
    * allocates buffer, size n; returns pointer to buffer. *
    * *
    * pushout(buffer,a,b): *
    * adds a to buffer; returns true if a overwrites oldest *
    * char which is copied to *b; returns false otherwise *
    * *
    * remchars(buffer,n): *
    * removes the n oldest chars from buffer *
    * *
    * matchkey(buffer,key): *
    * returns true if the string key matches the contents of *
    * the buffer, STARTING FROM THE OLDEST CHARACTER in buffer*
    * *
    * pick_char(buffer,k,b): *
    * copies kth oldest character in buffer to *b, returning *
    * true if successful or false if there was no such char *
    * *
    * dump_bufr(buffer): *
    * for debugging: writes to stderr the current contents of *
    * buffer and its idea of how many chars; the next vacant *
    * spot and/or oldest character is marked by >>> *
    * *
    * clr_bufr(buffer): *
    * empties, but doesn't destroy buffer *
    * *
    * delete_bufr(bufptr): *
    * destroys buffer (== *bufptr) sets *bufptr to null *
    * *
    ************************************************** **************/

    #ifndef BUFR
    #define BUFR void *
    #endif

    BUFR init_bufr(int);
    int pushout( BUFR , int, int * );
    int remchars( BUFR , int );
    int matchkey( BUFR , char * );
    int pick_char( BUFR , int, char * );
    void dump_bufr(BUFR );
    void clr_bufr(BUFR );
    void delete_bufr(BUFR *);

  2. #2
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,796
    So what's the problem?

    -Prelude
    My best code is written with the delete key.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 07-11-2008, 07:39 AM
  2. Structures, passing array of structures to function
    By saahmed in forum C Programming
    Replies: 10
    Last Post: 04-05-2006, 11:06 PM
  3. Input output with structures
    By barim in forum C Programming
    Replies: 10
    Last Post: 04-27-2004, 08:00 PM
  4. pointers to arrays of structures
    By terryrmcgowan in forum C Programming
    Replies: 1
    Last Post: 06-25-2003, 09:04 AM
  5. Methods for Sorting Structures by Element...
    By Sebastiani in forum C Programming
    Replies: 9
    Last Post: 09-14-2001, 12:59 PM

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