[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

how to create and allocate memory for hash table

Posted on 2010-11-13
6
Medium Priority
?
542 Views
Last Modified: 2012-05-10
How to create and allocate memory for hash table in C language/
0
Comment
Question by:woeishyong
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
6 Comments
 
LVL 37

Accepted Solution

by:
TommySzalapski earned 1000 total points
ID: 34128535
It's a hash table so just make an array and hash for the index.

Example
int hashtable[256];

Open in new window

void Hash(int* hashtable, int numToHash)
{
  hashtable[numToHash%256] = numToHash
}

Open in new window


If you need more help, provide more details.
0
 
LVL 40

Assisted Solution

by:evilrix
evilrix earned 1000 total points
ID: 34128640
>> How to create and allocate memory for hash table in C language/
Dynamically? Use malloc & free.

http://www.cplusplus.com/reference/clibrary/cstdlib/malloc/
http://www.cplusplus.com/reference/clibrary/cstdlib/free/
0
 
LVL 53

Expert Comment

by:Infinity08
ID: 34130075
This looks like a duplicate of http://www.experts-exchange.com/Programming/Languages/C/Q_26612981.html
Since duplicate questions are not allowed, please delete one of them, and only keep the one where you want to continue.
0
 
LVL 37

Expert Comment

by:TommySzalapski
ID: 34130799
I'm guessing he wanted to ignore the other one since he posted it in the wrong area. Must not have known we could move it for him.
0
 
LVL 40

Expert Comment

by:evilrix
ID: 34824219
This question has been classified as abandoned and is being closed as part of the Cleanup Program. See my comment at the end of the question for more details.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Summary: This tutorial covers some basics of pointer, pointer arithmetic and function pointer. What is a pointer: A pointer is a variable which holds an address. This address might be address of another variable/address of devices/address of fu…
Examines three attack vectors, specifically, the different types of malware used in malicious attacks, web application attacks, and finally, network based attacks.  Concludes by examining the means of securing and protecting critical systems and inf…
The goal of this video is to provide viewers with basic examples to understand opening and writing to files in the C programming language.
The goal of this video is to provide viewers with basic examples to understand how to use strings and some functions related to them in the C programming language.

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question