Thread: Usage of struct ** in linked lists

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,666
    I guess somewhere, you need to determine

    int numTreeBranches = 42;


    Then later, you can do
    mygate->inputs = malloc( numTreeBranches * sizeof(*(mygate->inputs)) );

    Then you're free to do
    mygate->inputs[x] = ....
    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.

  2. #2
    Registered User
    Join Date
    Jun 2018
    Posts
    4
    That is for the case of struct gate *inputs[ ] or for struct gates **inputs ???
    This data structure is created to represent logic gates input. I have created a program that calculates output of a circuit but can get only 2 inputs at each gate. Now this struct is needed in which Callback f is the function o f logic gate (and, or, nor...) and the **inputs needs to be the input of the gate.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Double Linked Dynamic Lists Vs Unrolled Linked Lists
    By lantzvillian in forum C Programming
    Replies: 6
    Last Post: 02-14-2012, 01:07 PM
  2. Replies: 4
    Last Post: 05-01-2010, 10:19 PM
  3. Struct Communication and Linked Lists
    By CaptainMorgan in forum C++ Programming
    Replies: 3
    Last Post: 09-10-2006, 07:44 AM
  4. question on linked lists(stack with linked lists)
    By dionys in forum C Programming
    Replies: 1
    Last Post: 06-02-2004, 11:08 AM
  5. Linked Lists and their usage...
    By SyntaxBubble in forum C++ Programming
    Replies: 3
    Last Post: 02-09-2002, 06:01 AM

Tags for this Thread