Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
Programming with Judy: C LanguageJudy Version 4.0 > Chapter 4 Example of a Multi-dimensional Array

Concepts

» 

Technical documentation

Complete book in PDF
» Feedback
Content starts here

 » Table of Contents

 » Glossary

 » Index

Copy each null-terminated string (index) into an array of N words (ulong_t's) with zero-padding in the last word if necessary. Use each word in this array as a level index in a multi-dimensional Judy array. For example, consider these two input strings:

  • "abcdefghijk"

  • "abcdefgk"

These are used as if they are arrays of 32- bit integers with the following keys:

  • "abcd", "efgh", "ijk0"

  • "abcd", "efgk", "0000"

Since a JudyL data element has both a key and a value, we can use the value to either point to another Judy array, or if the key contains a NULL, we can use the value area for user data. With this logic, the two strings above produce four Judy arrays:

Notes:

  • Only 32 bit versions of the WORDCPY macros are shown in this example.

  • You can find the code for this example and others on the Judy web site: http://devresource.hp.com/judy/

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© Hewlett-Packard Development Company, L.P.