title: How to print nested linked list pretty
body: <p>There is a structure like this:</p>
  
  <pre><code>struct a{
    char name[10];
    struct a* child;
    struct a* friend;
  };
  </code></pre>
  
  <p>And there are many objects with this structure and they linked as children and friends </p>
  
  <p>So I can access all of them if I know the first address</p>
  
  <p>The first object’s is this:</p>
  
  <pre><code>struct a start;
  </code></pre>
  
  <p>And I'm gonna set all the values in those objects when right after they are generated </p>
  
  <p>So if they don't have a child or a friend, their member variables of child and friend will be zero</p>
  
  <p>And I wanna print all those objects like this:  </p>
  
  <pre><code>a
  └ aa
    └ aaa
    │  └ aaaa
    ab
    ac
    └ aca
      acb
      acc
  </code></pre>
  
  <p>I'm really sorry for this terrible drawing </p>
  
  <p>So <code>a</code> is the name of <code>start</code> and <code>aa</code>
  is a child's name of <code>start</code> and <code>ab</code>, <code>ac</code> are <code>aa</code>’s friends. Something like this.</p>
  
  <p>I know how to print those special characters </p>
  
  <p>The problem is that the objects are determined at run time</p>
  
  <p>So I need an algorithm to print like that
  Like this:</p>
  
  <pre><code>void print(struct a* b)
  {
      if(b)
      {
          printf(”%s\n”, b-&gt;name);
          print(b-&gt;child);
          print(b-&gt;friend);
      }
  }
  </code></pre>
  
  <p>But it's way far from that I want</p>
  
  <p>I really don't know how to do that</p>
  
  <p>Is it possible?
  If not I wanna get some help on how to print such structure pretty</p>