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 7915565
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T14:29:49+00:00 2026-06-03T14:29:49+00:00

This is causing a lot of issues for my program. Whys is it when

  • 0

This is causing a lot of issues for my program. Whys is it when I create a new array of structured pointers that they all equal to '\0'? I checked if they are at the end of the array if(table_p -> buckets_array[i] == '\0'){ printf("ask this \n") ; } and it is true for every member of the array. Am I checking it wrong? Shouldn’t only the last member have \0?

typedef struct data_{
  char *key;
  void *data;
  struct data_ *next;
}data_el;

typedef struct hash_table_ {
  void **order;
  int *number_next_calls;
  int *number_buckets;
  int *buckets_size;
  int *worst;
  int *total;
  float *average;
  int (*hash_func)(char *);
  int (*comp_func)(void*, void*);
  data_el **buckets_array;
} hash_table, *Phash_table;

/*Create buckets array*/
table_p -> buckets_array = (data_el **)malloc(sizeof(data_el *)*(size+1));
table_p -> buckets_size = (int *)malloc(sizeof(int)*(size+1));

/*Setting order array*/
  table_p -> order = NULL;

/*Setting inital condictions*/
table_p -> worst = (int *)malloc(sizeof(int));
table_p -> total = (int *)malloc(sizeof(int));
table_p -> average = (float *)malloc(sizeof(float));
table_p -> number_buckets = (int *)malloc(sizeof(int));

/*This is where I have isssue*/
for(i = 0; i < size; i++){
    table_p -> buckets_array[i] = NULL;
    table_p -> buckets_array[i] -> buckets_size = 0;

    if(table_p -> buckets_array[i] == '\0'){
      printf("ask this \n");
    }
}
  • 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-03T14:29:51+00:00Added an answer on June 3, 2026 at 2:29 pm

    In your code, you have:

    table_p -> buckets_array[i] = NULL;
    table_p -> buckets_array[i] -> buckets_size = 0;
    

    That is like saying:

    table_p -> buckets_array[i] = NULL;
    NULL -> buckets_size = 0;
    

    which is not good.

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

Sidebar

Related Questions

I have an application that is causing a lot of headaches. It's a .NET
any ideas why this is causing my app to behave poorly? I did notice
The following code is causing this error: if (bestLine.size() > searchDepth - depth) bestLine.erase(bestLine.begin(),
Can anyone explain what might be causing this error. Im thinking its the quotes.
I'm not sure what is causing this, but I am using cluetip and binding
This wasn't happening before, so I'm assuming something I did is causing this, yet
I don't know what could be causing this issue, but for some reason, elements
I think my code might be written incorrectly and this is causing my problem.
I THINK this line is causing a 3.5K Byte memory leak, any ideas why?
EDIT: It does work (sorry). Something in this script is causing it to stop

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.