Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6329091
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T17:35:12+00:00 2026-05-24T17:35:12+00:00

This part of K&R (The C book) got me thinking: From the book: struct

  • 0

This part of K&R (The C book) got me thinking:

From the book:

struct tnode {
             char *word;
             int    count;
             struct tnode *left;
             struct tnode *right;
};

The recursion declaration of a node might look chancy, but it’s correct.

Because tnode’s defiition doesn’t use a tnode, but merely a pointer to a tnode somehow the compiler gives us a free pass. But I’m wondering how the computer knows how much memory to give a tnode, when it is declared?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T17:35:13+00:00Added an answer on May 24, 2026 at 5:35 pm

    Pointers have a fixed size (32/64 bit depending on the platform) so the compiler knows how much memory is need for the left and right pointers and can calculate the whole size of the struct.

    For the same reason if you need a pointer it’s enough to do a forward declaration struct tnode; and you can use a pointer for that struct, eg: struct tree { struct tnode* root; };

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was going through k&r complicated declarations part.I got doubt about this particular declaration.
This part of my code works fine: #include <stdio.h> int main(){ //char somestring[3] =
I am just starting to learn OpenGL today from this tutorial: http://openglbook.com/the-book/ I got
This code is from the K & R book - Chapter 8 Section 7:
This is two part question: I have two stored procedures: sp1 & sp2. If
I have this part of script from my GAE application which uses webapp2, which
Not sure if I'm doing this right: /(https?:\/\/\S+)(\s|(& nbsp;))?/g; This should match a URL
I'm trying to do a loop for this part: insert_front(&list,name[0]); insert_front(&list,name[1]); insert_front(&list,name[2]); but, i
From Accelerated C++ (book), I found this code which is identical program, but the
This code is from the book Data Structures and Problem Solving in C++(2003) void

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.