Sponsored Content
Top Forums Programming problem in multiplying arrays Post 302579471 by giampoul on Monday 5th of December 2011 07:10:08 PM
Old 12-05-2011
pff
problems appear again..
the error is gone,also a and b arrays are right but i c give me 0 in every i,j .
i think i call the arrays wrong at compute.c:
Code:
int *a,*b,*c;
a=(int *)shmat(id,NULL,0);

b=(int *)shmat(id,NULL,0);

c=(int *)shmat(id,NULL,0);

is this the right way or i have to call the arrays like in the main ??
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Error only when multiplying two numbers

Hi $ a=10 ; b=2 $ expr $a + $b 12 $ expr $a - $b 8 $ expr $a / $b 5 $ expr $a * $b expr: syntax error Any idean why I am getting this error only when multiplying two numbers. Whats the exact syntax? Thanks a lot to all in advance CSaha (5 Replies)
Discussion started by: csaha
5 Replies

2. Shell Programming and Scripting

Multiplying Floats/Decimals

Is there a way that i can get something like this to work: Number=`expr 80 \* 10.69` i.e. To multiply an integer by a decimal or a decimal by a decimal etc...? thanks (10 Replies)
Discussion started by: rleebife
10 Replies

3. Shell Programming and Scripting

Problem with arrays in awk

Hello! I'm trying to make a script that will make a list of the files in a source tree and sort them by size. Problem is I've run into a weird problem. print array will give me numbers like 160, 220, 444 that i don't even know where they come from, and print array will give me the correct numbers... (5 Replies)
Discussion started by: Glauco
5 Replies

4. Programming

C programming + problem with char arrays

Im trying to write some code atm which gets the complete pathname of a folder and strips off references to the parent folders. The end result should be just the name of the folder. Currently Im able to extract the folder name, however Im getting junk added onto the name as well which is making... (7 Replies)
Discussion started by: JamesGoh
7 Replies

5. UNIX for Dummies Questions & Answers

Problem assigning variables to arrays

Hi All, I have a problem assigning variables to script.I have a script in which i have a while loop now i have to assign some values obtained to an array which will be used later in the script.Can anyone help how to do that. At present my scrot looks like: co=0 pco=0 co=`cat /tmp/highcpu... (4 Replies)
Discussion started by: usha rao
4 Replies

6. Shell Programming and Scripting

Problem with arrays

Hi I have two arrays: arr1 = (demo demo2 demo3 demo4 demo5) arr2 = (demo2 test demo) I want to check that the values the "arr2" are present in "arr1" Example arr1 = (demo demo2 demo3 demo4 demo5) arr2 = (demo2 test demo) Output: Error arr1 = (demo demo2 demo3 demo4 demo5)... (3 Replies)
Discussion started by: blito_loco
3 Replies

7. Programming

question about int arrays and file pointer arrays

if i declare both but don't input any variables what values will the int array and file pointer array have on default, 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? (1 Reply)
Discussion started by: omega666
1 Replies

8. Shell Programming and Scripting

Problem with arrays and loop

Hello , im sorry for my english . im trying to create a dynamic menu that will display if the interface is ACTIVE OR STOPPED/FAILED for some reason i cant get it to work properly start_interface_func() { i=0 for interface_chk in 11 71 73 72 12 47 48 49 50 20 23 24 25 46 21 22 27 28... (5 Replies)
Discussion started by: visiown
5 Replies

9. Shell Programming and Scripting

Multiplying array element

I am trying to take all the elements of an array and multiply them by 2, and then copy them to a new array. Here is what I have i=0 for true in DMGLIST do let DMGSIZES2="${DMGSIZES}"*2 let i++ done unset i echo ${DMGSIZES2} It does the calculation correctly for the first element,... (7 Replies)
Discussion started by: nextyoyoma
7 Replies

10. Programming

Multiplying 2D arrays using fork()

HI, i am trying to multiply 2 2D arrays (a,b) using fork. The answer will be at c. Each child have to calculate 1 row of c. The code is right, as i think of it, with no errors but i dont get the correct c array... I think there is maybe a mistake in i dimension ... Anyway, here is the code: ... (16 Replies)
Discussion started by: giampoul
16 Replies
explain_shmat_or_die(3) 				     Library Functions Manual					   explain_shmat_or_die(3)

NAME
explain_shmat_or_die - shared memory attach and report errors SYNOPSIS
#include <libexplain/shmat.h> void *explain_shmat_or_die(int shmid, const void *shmaddr, int shmflg); void *explain_shmat_on_error(int shmid, const void *shmaddr, int shmflg); DESCRIPTION
The explain_shmat_or_die function is used to call the shmat(2) system call. On failure an explanation will be printed to stderr, obtained from the explain_shmat(3) function, and then the process terminates by calling exit(EXIT_FAILURE). The explain_shmat_on_error function is used to call the shmat(2) system call. On failure an explanation will be printed to stderr, obtained from the explain_shmat(3) function, but still returns to the caller. shmid The shmid, exactly as to be passed to the shmat(2) system call. shmaddr The shmaddr, exactly as to be passed to the shmat(2) system call. shmflg The shmflg, exactly as to be passed to the shmat(2) system call. RETURN VALUE
The explain_shmat_or_die function only returns on success, see shmat(2) for more information. On failure, prints an explanation and exits, it does not return. The explain_shmat_on_error function always returns the value return by the wrapped shmat(2) system call. EXAMPLE
The explain_shmat_or_die function is intended to be used in a fashion similar to the following example: void *result = explain_shmat_or_die(shmid, shmaddr, shmflg); SEE ALSO
shmat(2) shared memory attach explain_shmat(3) explain shmat(2) errors exit(2) terminate the calling process COPYRIGHT
libexplain version 0.52 Copyright (C) 2011 Peter Miller explain_shmat_or_die(3)
All times are GMT -4. The time now is 02:48 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy