Sponsored Content
Top Forums Programming assign array with a local var??? Post 302510838 by zing_foru on Tuesday 5th of April 2011 06:09:43 AM
Old 04-05-2011
assign array with a local var???

Hi all,

I am just wondering is this (below code) valid in programming
Code:
   int xx = 10110;
   int i;
   long yy[] = {1,2,3,4,5,6,7,8,xx};

I compiled this using gcc will all working option successfully without getting any warning or error. I didn't see this kind of code in my past experience. Please comment the cons if any

Thanks and Regards...

Last edited by Franklin52; 04-05-2011 at 07:33 AM.. Reason: Fixed code tags
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

assign awk array with printf

I am trying to assign a awk array for further processing later in the script. I can't seem to figure it out. If someone could look at this and help me, I would very much appreciate it. Thanks in Advance. for ( x = 1 ; x <= Var ; x++ ) { if ( x in varr ) { ... (2 Replies)
Discussion started by: timj123
2 Replies

2. Shell Programming and Scripting

SSH script. (Assign $var to free cmd) ???

Running: GNU/Linux, 2.6.22.9-61.fc6 (hope that's the right info needed) I am trying give the amount of RAM and the % used. I am using free command. I am having some problems with this command code: 1)T = `free | grep Mem | awk '{print $2}'` F = `free | grep Mem | awk '{print $4}'`... (3 Replies)
Discussion started by: AngelFlesh
3 Replies

3. Shell Programming and Scripting

Assign words in a string to array

I have a string as "yes why not" I want to create one array variable with contents as one word per place in array.. for above string,the array variable should contain... x="yes,why,not" x = yes x = why x = not Please help me,I am stuck up in the problem since 2 days... (3 Replies)
Discussion started by: uday26
3 Replies

4. Shell Programming and Scripting

How to assign a variable to an array

I want to ask the user to enter an X amount of file names. I want to put those names into an array and then loop back through them to verify they are in the directory. 1st- How would I assign the value to an array and what is the correct syntax. 2nd- how would i reference that array after I... (3 Replies)
Discussion started by: tvb2727
3 Replies

5. Shell Programming and Scripting

assign var with set=a[5] not working

Hi Experts, I'm having issue in assigning var with special character , please see below for complete details. $ echo $SHELL /bin/csh $ cat bp abd/asd/a $ awk -F "/" '{print $NF}' bp | awk '{print $1}' a $ set a=`awk -F "/" '{print $NF}' bp | awk '{print $1}'` $ echo $a ... (15 Replies)
Discussion started by: novice_man
15 Replies

6. Shell Programming and Scripting

assign value to array variable

Hi, I have a piece of code as follows: i=0 while read LINE do var = "$LINE" i=$((i+1)) echo "${var}" done < file I want to assign value to the array var. However, when i execute the script i get a error. Please can you help me know what i am missing. I ultimately want to... (2 Replies)
Discussion started by: sunrexstar
2 Replies

7. UNIX for Advanced & Expert Users

assign array with a local var???

topic moved to programming (0 Replies)
Discussion started by: zing_foru
0 Replies

8. Shell Programming and Scripting

Assign value to array separated by #

Hi all , I have a string like para1#para2#para3 i want to assign para1 as first element para2 as second and so on i tried IFS=# set -A array para1#para2#para3 echo ${array} para1 para2 para3 i want echo ${array} para1 (2 Replies)
Discussion started by: max_hammer
2 Replies

9. Shell Programming and Scripting

How to Assign an shell array to awk array?

Hello All, Can you please help me with the below. #!/bin/bash ARR="No Differences In Stage Between HASH_TOTALS & HASH_TOTALS_COMP For UNINUM:0722075 PROVIDER:5 EXTRACT_DT:30-SEP-12 VER_NUM:1" ARR="No Differences In Stage Between HASH_TOTALS & HASH_TOTALS_COMP For UNINUM:0722075 PROVIDER:5... (14 Replies)
Discussion started by: Ariean
14 Replies

10. Shell Programming and Scripting

Assign two dimensional array in bash at once

Hi, I have a 10*10 two dimensional array. How do I assign value to all it's 100 elements at once? I don't want to open two for loops and assign one by one. Thanks, Amit (2 Replies)
Discussion started by: amit14august
2 Replies
PTHREAD_MUTEXATTR_SETKIND_NP(3) 			     Library Functions Manual				   PTHREAD_MUTEXATTR_SETKIND_NP(3)

NAME
pthread_mutexattr_setkind_np, pthread_mutexattr_getkind_np - deprecated mutex creation attributes SYNOPSIS
#include <pthread.h> int pthread_mutexattr_setkind_np(pthread_mutexattr_t *attr, int kind); int pthread_mutexattr_getkind_np(const pthread_mutexattr_t *attr, int *kind); DESCRIPTION
These functions are deprecated, use pthread_mutexattr_settype(3) and pthread_mutexattr_gettype(3) instead. RETURN VALUE
pthread_mutexattr_getkind_np always returns 0. pthread_mutexattr_setkind_np returns 0 on success and a non-zero error code on error. ERRORS
On error, pthread_mutexattr_setkind_np returns the following error code: EINVAL kind is neither PTHREAD_MUTEX_FAST_NP nor PTHREAD_MUTEX_RECURSIVE_NP nor PTHREAD_MUTEX_ERRORCHECK_NP AUTHOR
Xavier Leroy <Xavier.Leroy@inria.fr> SEE ALSO
pthread_mutexattr_settype(3), pthread_mutexattr_gettype(3). LinuxThreads PTHREAD_MUTEXATTR_SETKIND_NP(3)
All times are GMT -4. The time now is 04:28 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy