buffer

This is a discussion on buffer within the C Programming forums, part of the General Programming Boards category; Hey. Im trying to make a circular buffer in c but I dont know how to go about doing it. ...

  1. #1
    Registered User
    Join Date
    Oct 2002
    Posts
    291

    buffer

    Hey.

    Im trying to make a circular buffer in c but I dont know how to go about doing it. Was wondering if anyone could help me out with simple code example or point to any related web site. Have search both this site and google without finding any good help.

    Appreciate any response.

  2. #2
    Registered User
    Join Date
    Oct 2002
    Posts
    291
    Why use :
    #define N 10

    could I use :
    const n = 10;

    If I need multiple buffers can I place above code inside struct ? (Is struct similar to class ? )

    btw, thanks for your response

  3. #3
    Registered User
    Join Date
    Aug 2002
    Posts
    351
    a struct is similar to a class in as much as it encapsulates the attributes of an object.

    Code:
    struct car
    {
            char *reg;
            int number_of_wheels;
            int engine_capacity;
    }
    normally behaviour, i.e. functions, is defined outside of the struct as seperate entities.

  4. #4
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,659
    In C++, structs and classes are identical save for one trait: by default, all class members are private whereas with structs, public. Thus even structs can have methods(functions). This is why C++ is superior to C.



    ITSA
    Socket Library!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 16
    Last Post: 10-29-2006, 04:04 AM
  2. writing a pack-style function, any advices?
    By isaac_s in forum C Programming
    Replies: 10
    Last Post: 07-08-2006, 08:09 PM
  3. buffer contents swapping
    By daluu in forum C++ Programming
    Replies: 7
    Last Post: 10-14-2004, 02:34 PM
  4. Tetris Questions
    By KneeGrow in forum Game Programming
    Replies: 19
    Last Post: 10-28-2003, 10:12 PM
  5. Console Screen Buffer
    By GaPe in forum Windows Programming
    Replies: 0
    Last Post: 02-06-2003, 04:15 AM

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