Fine that it works, but you still have these in there which redundant since you already declared the array.... (why do I have to type everything 3 times )
I want to pass an array in my function, And my function will be changing the elements of the array in the fuction, but it should not affect the values in my array variable of main function (1 Reply)
Hi,
I have a master BASH shell script where I define a bunch of variables:
$var1=why
$var2=is
$var3=(this so hard)
I would then like to call another shell script and pass these variables to it:
$script2 $var1 $var2 $var3
This works fine for var1 and var2. However, var3 is an array,... (9 Replies)
Hi all..
Does anyone know have an example of passing the contents of a ksharray to oracle?
basically I am looking to loop through the contents of a file and store each line into a bash ksh. Once i have this I can then pass the array into an oracle procedure that accepts an array as an... (1 Reply)
Hi,
I have an output generated from a shell script like;
0x41,0xF2,0x59,0xDD,0x86,0xD3,0xEF,0x61,0xF2
How can I pass this value to the C function, as below;
int main(int argc, char *argv) {
unsigned char hellopdu={above value};
}
Regards
Elthox (1 Reply)
Hi All,
I have some questions regarding array arguements passing for Perl Function.
If @array contains 2 items , arguements passing would be like Code_A.
But what if @array needs to add in more items, the rest of the code like $_ will have to be modified as well (highlighted in red), which is... (5 Replies)
Hi,
Please guide to pass an array as a arg to a script...
for example,
I have a script small.sh to find the small no of given arg as below...
#! /bin/sh
# this script is for finding the small number
set -A arr_no_updates
small=$1
i=1
for arr in $@
do
if (3 Replies)
Hi,
I am facing one issue. The awk command works fine if i hardcode the file name but if is pass it as an arguement it doesn't work. For e.g:Below commands works fine
awk -v A="$type" '{F=substr($0,23,8) "_LTD_" A ".txt"; print $0 >> F; close(F) }' RL004.txt
But the below command does not... (2 Replies)
How do i pass an array from test4.sh to a function in another shell script test5.sh, basically i am sourcing the test5.sh in test4.sh and printing the contents, but not working below are my trial scripts, please help, thank you.
#!/bin/bash
# /usr/local/dw/archive/test5.sh
print_array()
{... (5 Replies)
Hi All
I have multiple arrays like below.
set -A val1 1 2 4 5
set -A val2 a b c d
.
.
.
Now i would like to pass the individual arrays one by one to a function and display/ do some action.
Note : I am using ksh
Can you please advise any solution...
Thanks in advance. (7 Replies)
Hi,
I am creating filesystem for block device, but I want to pass array value one by one acording to block device count.
$tmp1 = block device count 3
$blockdevice =
So I want to first pass sdb1 alone in loop, how to take only block device seprately from $blockdevice array. (1 Reply)
Discussion started by: stew
1 Replies
LEARN ABOUT BSD
malloc
MALLOC(3F)MALLOC(3F)NAME
malloc, free, falloc - memory allocator
SYNOPSIS
subroutine malloc (size, addr)
integer size, addr
subroutine free (addr)
integer addr
subroutine falloc (nelem, elsize, clean, basevec, addr, offset)
integer nelem, elsize, clean, addr, offset
DESCRIPTION
Malloc, falloc and free provide a general-purpose memory allocation package. Malloc returns in addr the address of a block of at least
size bytes beginning on an even-byte boundary.
Falloc allocates space for an array of nelem elements of size elsize and returns the address of the block in addr. It zeros the block if
clean is 1. It returns in offset an index such that the storage may be addressed as basevec(offset+1) ... basevec(offset+nelem). Falloc
gets extra bytes so that after address arithmetic, all the objects so addressed are within the block.
The argument to free is the address of a block previously allocated by malloc or falloc; this space is made available for further alloca-
tion, but its contents are left undisturbed. To free blocks allocated by falloc, use addr in calls to free, do not use basevec(offset+1).
Needless to say, grave disorder will result if the space assigned by mallocorfalloc is overrun or if some random number is handed to free.
DIAGNOSTICS
Malloc and falloc set addr to 0 if there is no available memory or if the arena has been detectably corrupted by storing outside the bounds
of a block.
The following example shows how to obtain memory and use it within a subprogram:
integer addr, work(1), offset
...
call falloc ( n, 4, 0, work, addr, offset )
do 10 i = 1, n
work(offset+i) = ...
10 continue
The next example reads in dimension information, allocates space for two arrays and two vectors, and calls subroutine doit to do the compu-
tations:
integer addr, dummy(1), offs
read *, k, l, m
indm1 = 1
indm2 = indm1 + k*l
indm3 = indm2 + l*m
indsym = indm3 + k*m
lsym = n*(n+1)/2
indv = indsym + lsym
indtot = indv + m
call falloc ( indtot, 4, 0, dummy, addr, offs )
call doit( dummy(indm1+offs), dummy(indm2+offs),
. dummy(indm3+offs), dummy(indsym+offs),
. dummy(indv +offs), m, n, lsym )
end
subroutine doit( arr1, arr2, arr3, vsym, vec, m, n, lsym )
real arr1(k,l), arr2(l,m), arr3(k,m), vsym(lsym), v2(m)
...
FILES
/usr/lib/libU77.a
SEE ALSO malloc(3)4.3 Berkeley Distribution May 15, 1985 MALLOC(3F)