Sponsored Content
Top Forums Programming question about int arrays and file pointer arrays Post 302504996 by Corona688 on Wednesday 16th of March 2011 12:15:09 AM
Old 03-16-2011
Quote:
Originally Posted by omega666
if i declare both but don't input any variables what values will the int array and file pointer array have on default
If they're stack variables, then undefined. Their contents may depend on your system, compiler, and moon phase. In short: don't use them until you set them somehow.
Quote:
and if i want to reset any of the elements of both arrays to default, should i just set it to 0 or NULL or what?
Define 'defaults'. If you want 0, set them to 0. If you want 37, set them to 37. If you want NULL, set them to NULL (which just amounts to 0 anyway, but is better for pointers...)
 

10 More Discussions You Might Find Interesting

1. Programming

Question about Arrays

Ok this is probably pretty easy but I'm stuck. My program reads the contents of a txt file and stores the string into a char array called buff. The contents of the text file is a string of a txt file name. So basically buff has this value "file.txt\0". The last part is the null character. I want... (3 Replies)
Discussion started by: johnsonmj
3 Replies

2. Shell Programming and Scripting

Arrays & File Reading

Ok; here is the code INCREMENT=0 #Final Count MATCH=0 #Treated as a Boolean declare -a LINEFOUR #Declared Array for FILE in $DIR; do # DIR was declared earlier test -f $FILE && ( TEMP=(sed -n '4p' $FILE) #How do I assign the fourth line of the file to TEMP? This doesn't... (1 Reply)
Discussion started by: Asylus
1 Replies

3. Shell Programming and Scripting

Struggling with arrays and delimited file

Hi, I am trying to use arrays in my script but can not seem to get it to work. I have a file called sections, this contains headers from a tripwire log file, separated by "@" but could be "," if easier The headers will be used to cut sections from the log file into another to be mailed. ... (5 Replies)
Discussion started by: pobman
5 Replies

4. Web Development

PHP arrays in arrays

PHP question... I have an SQL query that's pulled back user IDs as a set of columns. Rather than IDs, I want to use their names. So I have an array of columns $col with values 1,7,3,12 etc and I've got an array $person with values "Fred", "Bert", "Tom" etc So what I want to do is display the... (3 Replies)
Discussion started by: JerryHone
3 Replies

5. UNIX for Dummies Questions & Answers

portability of int arrays from 32 to 64 bit systems

Dear All, I'm porting my scientific program from 32 to 64 bit system (use gcc, CentOS) and feel myself absolutely confused after reading general internet advices for that. Could you help me, please. The question is: can I use "old style" on 64 bit: -------- int * myIntArray; ... (3 Replies)
Discussion started by: German1234
3 Replies

6. Shell Programming and Scripting

PERL: simple comparing arrays question

Hi there, i have been trying different methods and i wonder if somebody could explain to me how i would perform a comparison on two arrays for example my @array1 = ("gary" ,"peter", "paul"); my @array2 = ("gary" ,"peter", "joe"); I have two arrays above, and i want to something like this... (5 Replies)
Discussion started by: hcclnoodles
5 Replies

7. Shell Programming and Scripting

Yet another bash arrays question

Hi all, I have a file that contains many lines, but only a few are of my interest, so I'm cutting it with grep + awk, and the result I get is for example line 0 line 1 line 2 line 3 line n Now I want to store each line in an array "cell" so I can use it later calling to ${array},... (2 Replies)
Discussion started by: TuxSax
2 Replies

8. Shell Programming and Scripting

Reading a .dat file in to 2 different arrays

hi all, i have a data file that contains 2 columns, names and numbers. i need to read names in to a an array call names and numbers in to an array call numbers. i also have # and blank lines in my dat file and i need to skip those when i read the dat file. how do i do this? btw, my column 1 and... (3 Replies)
Discussion started by: usustarr
3 Replies

9. Shell Programming and Scripting

Saving file content in arrays using AWK

Hi, im new to shell scripting. i have a query for which i have searched your forums but coulndt get what i need. i have a file that has two records of exactly the same length and format and they are comma seperated. i need to save the first and the second columns of the input file to 2 different... (11 Replies)
Discussion started by: atikan
11 Replies

10. UNIX for Dummies Questions & Answers

If statement between different file's arrays

Hi guys Let me explain at first what I'm trying to do. My input file looks like this. 1280 Surfaces Pt 0.00000000000000 0.00000000000000 0.00000000000000 Pt 2.81138845918055 0.00000000000000 0.00000000000000 Pt 5.62277691836110 0.00000000000000 ... (5 Replies)
Discussion started by: saleheen
5 Replies
Judy(3X)																  Judy(3X)

NAME
Judy functions - C libraries for creating and accessing dynamic arrays SYNOPSIS
Judy1 - maps an Index (word) to a bit JudyL - maps an Index (word) to a word JudySL - maps an Index (string) to a word DESCRIPTION
The Judy family of functions supports fully dynamic arrays. These arrays may be indexed by a 32- or 64-bit word (depending on the proces- sor) or a string. A dynamic array that is sparsely populated can be thought of as a mapping function. There are 3 different Judy mappings currently supported: Judy1 maps an Index (word) to a bit. JudyL maps an Index (word) to a word. JudySL maps an Index (string) to a word. For Judy1 functions and JudyL functions, Index should be declared as a Word_t type. Word_t is defined in the Judy.h header file as a 32- or 64-bit unsigned native integer, and has the same number of bits as a pointer. For JudySL functions, each index is a null-terminated string. Judy arrays are both speed- and memory-efficient, with no tuning or configuration required, across a wide range of index set types (sequen- tial, periodic, clustered, random). Judy's speed and memory usage are typically better than other data storage models such as skiplists, binary trees, b-trees, or even hashing, and improves with very large data sets. A Judy array is created merely by defining a null pointer and then storing (inserting) the first element into the array under that pointer. The memory used by a Judy array is proportional to the population (number of elements). Judy has two Application Program Interfaces (APIs): a C macro interface, and a function call interface. Because the macro forms are faster and have a simpler error handling interface than the equivalent functions, they are the preferred way of calling the Judy functions. Since an initial (empty) Judy array is represented by a null pointer, it is possible to construct an array of Judy arrays. In other words, a Judy array's values (except Judy1) can be pointers to other Judy arrays. AUTHOR
Judy was invented and implemented by Hewlett-Packard. (Note: Judy is named for the inventor's sister.) FILES
Locations of interest include: Documents, including HTML versions of the manual entries. Demonstration program source files. SEE ALSO
Judy1(3X), JudyL(3X), JudySL(3X), the Judy website, http://www.hp.com/go/judy/, for more information and Application Notes. Judy(3X)
All times are GMT -4. The time now is 07:53 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy