Problem in static structure array in C


 
Thread Tools Search this Thread
Top Forums Programming Problem in static structure array in C
Prev   Next
# 1  
Old 12-11-2008
Problem in static structure array in C

Hi,

I have a following problem in C.

I have a function A in which I used to call another function (function B) and pass an array of values through array variable by using below:-

foo=functionB(array);

In functionB, i used to just return some "values" (e.g return num;) in order to pass the value to foo variable.

However, now I am trying to return several values to different array of foo variable.

foo[NUMBER]=functionB(array).

So, in my case, I have to create a struct in order to return struct all together for respective members. However , I came across errors of referring members in struct.

Basically, I try something below:-

#define NUMBER 10

struct boo{
static int min;
static int max;
}me[NUMBER];

In function A, i have
for (i=0;i<NUMBER;i++)
foo[i]=functionB(me[i], array); /* which is supposed to pass the array value and refer the struct me[i] members*/

In my function B, i try to have

double function(double me[],double array){
int m;

me[m].min=i*1;

me[m].max=i*2;

return 0;
}

But the error returned to me is
error: request for member ‘min' in something not a structure or union
error: request for member ‘max' in something not a structure or union


Please advise. Thanks.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Problem compiling glib using static zlib

Hello I have been trying to compile glib 2.28 with needs Zlib. During the compilation process I received these messages Then giving a look at the configure of Zlib, there was an option to static link it and I obviously used it. So I think I can solve it by compiling a shared zlib, or by... (4 Replies)
Discussion started by: colt
4 Replies

2. Solaris

Solaris 11 problem with static ip

I have installed Solaris 11.2 in VMware Player, networked in bridged mode. When Solaris uses DHCP everything is OK, I can reach internet, as well as other systems on my LAN. When I switch to static, I have connections to my LAN, but can not get to internet, the DNS resolution is somehow not... (2 Replies)
Discussion started by: migurus
2 Replies

3. Programming

GDB problem accessing static variables in C

Hi, Can anyone explain this please..... This is on AIX with GDB (tried a few versions). It only happens when program compiled in 64 bit and only with static variables.... A simple test program... ### snip #include <stdio.h> main() { static int n; n = 6; printf("hello %d\n", n);... (0 Replies)
Discussion started by: bagpussnz
0 Replies

4. Programming

C Data Structure to represent a Sparse Array

Which data structure will be most appropriate to represent a sparse array? (1 Reply)
Discussion started by: rupeshkp728
1 Replies

5. Programming

Even the Static cURL Library Isn't Static

I'm writing a program which uses curl to be run on Linux PCs which will be used by a number of different users. I cannot make the users all install curl on their individual machines, so I have tried to link curl in statically, rather than using libcurl.so. I downloaded the source and created a... (8 Replies)
Discussion started by: BrandonShw
8 Replies

6. Programming

structure pointer array as function parameters

if i create an array of pointers to a structure "struct node" as: struct node *r; and create "n" number of "linked lists" and assign it to the various struct pointers r using some function with a return type as structure pointer as: r=multiplty(.......) /*some parameters*/ is... (2 Replies)
Discussion started by: mscoder
2 Replies

7. Programming

Problem with static compiling - GCC

Hi guys. I want to compile three files: gcc -static main.c fib.c fib.h it is pure C i mean i use standard C library. but it gives me this error: /usr/bin/ld: cannot find -lc collect2: ld returned 1 exit status what should i do? (4 Replies)
Discussion started by: majid.merkava
4 Replies

8. IP Networking

I need HELP to Set up Coyote Linux router with 1 static IP & 64 internal static IP

hello, i need help on setting my coyote linux, i've working on this for last 5 days, can't get it to work. I've been posting this message to coyote forum, and other linux forum, but haven't get any answer yet. Hope someone here can help me...... please see my attached picture first. ... (0 Replies)
Discussion started by: dlwoaud
0 Replies

9. Shell Programming and Scripting

problem with listing of directory structure

Hi When im listing (ls -al ) its listing directories without / at the end of directories dir1 dir2 dir3 and i need to list directories with dir1/ dir2/ dir3/ and this should not be made by command ls -F / should be embedded at the last since one of the scripts reads directories... (1 Reply)
Discussion started by: vasanthan
1 Replies

10. UNIX for Dummies Questions & Answers

Problem w. case structure

Hello, I am having a problem setting a range of numbers for the "case" structure. I can use with no problems, but when I use it doesn't work??? Does the case struture allow numeric ranges? eg: echo -e "enter number between 0 and 60: \c" read $answer case $answer in ) echo... (2 Replies)
Discussion started by: Joe54321
2 Replies
Login or Register to Ask a Question
WINCACHE_UCACHE_SET(3)							 1						    WINCACHE_UCACHE_SET(3)

wincache_ucache_set - Adds a variable in user cache and overwrites a variable if it already exists in the cache

SYNOPSIS
bool wincache_ucache_set (mixed $key, mixed $value, [int $ttl]) DESCRIPTION
bool wincache_ucache_set (array $values, [mixed $unused = NULL], [int $ttl]) Adds a variable in user cache. Overwrites a variable if it already exists in the cache. The added or updated variable remains in the user cache unless its time to live expires or it is deleted by using wincache_ucache_delete(3) or wincache_ucache_clear(3) functions. PARAMETERS
o $key - Store the variable using this $key name. If a variable with same $key is already present the function will overwrite the previ- ous value with the new one. $key is case sensitive. $key can also take array of name => value pairs where names will be used as keys. This can be used to add multiple values in the cache in one operation, thus avoiding race condition. o $value - Value of a variable to store. $Value supports all data types except resources, such as file handles. This paramter is ignored if first argument is an array. A general guidance is to pass NULL as $value while using array as $key. If $value is an object, or an array containing objects, then the objects will be serialized. See __sleep() for details on serializing objects. o $values - Associative array of keys and values. o $ttl - Time for the variable to live in the cache in seconds. After the value specified in $ttl has passed the stored variable will be deleted from the cache. This parameter takes a default value of 0 which means the variable will stay in the cache unless explic- itly deleted by using wincache_ucache_delete(3) or wincache_ucache_clear(3) functions. RETURN VALUES
If $key is string, the function returns TRUE on success and FALSE on failure. If $key is an array, the function returns: o If all the name => value pairs in the array can be set, function returns an empty array; o If all the name => value pairs in the array cannot be set, function returns FALSE; o If some can be set while others cannot, function returns an array with name=>value pair for which the addition failed in the user cache. EXAMPLES
Example #1 wincache_ucache_set(3) with $key as a string <?php $bar = 'BAR'; var_dump(wincache_ucache_set('foo', $bar)); var_dump(wincache_ucache_get('foo')); $bar1 = 'BAR1'; var_dump(wincache_ucache_set('foo', $bar1)); var_dump(wincache_ucache_get('foo')); ?> The above example will output: bool(true) string(3) "BAR" bool(true) string(3) "BAR1" Example #2 wincache_ucache_set(3) with $key as an array <?php $colors_array = array('green' => '5', 'Blue' => '6', 'yellow' => '7', 'cyan' => '8'); var_dump(wincache_ucache_set($colors_array)); var_dump(wincache_ucache_set($colors_array)); var_dump(wincache_ucache_get('Blue')); ?> The above example will output: array(0) {} array(0) {} string(1) "6" SEE ALSO
wincache_ucache_add(3), wincache_ucache_get(3), wincache_ucache_delete(3), wincache_ucache_clear(3), wincache_ucache_exists(3), win- cache_ucache_meminfo(3), wincache_ucache_info(3), __sleep(). PHP Documentation Group WINCACHE_UCACHE_SET(3)