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

  • SEARCH
  • Home
  • 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 7985969
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T11:42:45+00:00 2026-06-04T11:42:45+00:00

I currently have no code, because I don’t know how to do this at

  • 0

I currently have no code, because I don’t know how to do this at all. Could I just, by myself, calculate how many bytes is needed for each lower-level struct and malloc it to it? That’s really terrible coding, isn’t it. Here’s the two structs I’m trying to mash together:

struct property {
    int d;
    char name [111]; // I just malloc this like I would a normal array, right?
    char descr [1025]; // Ditto.
}

struct category {
    int d [413]; // The d's of all the child structs sorted highest to lowest.
    char name [111];
    struct property property [413]; // This. How do I allocate this?
}</code>

Do I have to do struct property* property = (struct property*) malloc(sizeof(struct property) * 413);? Will the malloc of the array within remain intact? How do mallocs in structs behave in general?

  • 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-06-04T11:42:46+00:00Added an answer on June 4, 2026 at 11:42 am

    You don’t have a pointer member inside your structure property so you don’t need to malloc any of your structure members.
    When you malloc for the structure it will give you enough memory to hold all the structure members including arrays, exceptions are pointer structure members(You don’t have any).

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

Sidebar

Related Questions

I currently have this code but it leaks because I don't know how to
Hello I currently have this code checking if a cookie exists, it works all
Using dotnet 2.0. I currently have code like this : DataView dv = new
I currently have this code which reads the first field in a database record
Ok I currently have this code public int i = 0; //this is outside
Currently I have this code var App = Ember.Application.create(); App.user = Ember.Object.create({ people: customers
We all know that wordpress have simple .htaccess code like below RewriteEngine on RewriteBase
I currently have code that does the following: private final static ExecutorService pool =
I currently have code in objective C that can pull out an integer's most
I currently have my code set to disable the submit button when the field

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.