#Hash Table and Linked Array

6 messages · Page 1 of 1 (latest)

glossy quailBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.

latent bay
#

open.h

#ifndef OPEN_H
#define OPEN_H

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define MAX_HASH 1000

typedef struct {
    char **addr;
} HashTable;

// Structure to hold the table data
typedef struct {
    char *headers[4];   // Array of pointers for headers
    char **id;
    HashTable hashTable[MAX_HASH];
    int col_count;      // Number of columns
    int row_count;      // Number of rows
} TableData;

// Function to read file content
char *getFileContent(const char *filename);

// Function to extract table data from content
TableData *extractTable(char *content);

// Function to free allocated memory for TableData
void freeTableData(TableData *data);

void printTableData(TableData *data);

#endif // OPEN_H
latent bay
#

i realised that how my data was stored was correct. I learnt this when i tried to debug with an know stored ID. for example
printf("%s\n", *(data->hashTable[2304567%MAX_HASH].addr + 3)); --> Digital Supply Chain

So i believe there is smt wrong with my printTableData function. its not printing it right

latent bay
#

!solved

glossy quailBOT
#

Thank you and let us know if you have any more questions!

This thread is now set to auto-hide after an hour of inactivity