Sponsored Content
Top Forums Programming structure pointer array as function parameters Post 302532632 by mscoder on Tuesday 21st of June 2011 12:50:09 PM
Old 06-21-2011
structure pointer array as function parameters

if i create an array of pointers to a structure "struct node" as:
Code:
struct node *r[n];

and create "n" number of "linked lists" and assign it to the various struct pointers r[i] using some function with a return type as structure pointer as:
Code:
r[i]=multiplty(.......)  /*some parameters*/

is it wrong to then use the individual array members like r[0],r[1] (which are now pointers to various linked lists) etc. as parameters to a function that accept a structure pointers as parameter like::
Code:
struct node *add_result;
add_result= add(r[o],r[1]);/*add() returns a struct pointer,no error shown in compilation */

the programme goes into an infinite loop whenever i try to display the list pointed by add_result..the functions add() and display() work fine in other cases..

Last edited by mscoder; 06-21-2011 at 02:11 PM..
 

10 More Discussions You Might Find Interesting

1. Programming

Problem with function which reutrns pointer to a value

i have a function: char *pcCityIdToCountryName(ADMIN_DB_DATA *pstHEader, unit uiCityID) this returns a pointer to CountryName if cityId is given. to retrieve countryname i give: char *CountryName; CountryName = pcCityIdToCountryName(..................); but when i compile it is giving :... (5 Replies)
Discussion started by: jazz
5 Replies

2. Programming

Accesing structure member:Error:dereferencing pointer to incomplete type

$ gcc -Wall -Werror struct.c struct.c: In function `main': struct.c:18: error: dereferencing pointer to incomplete type $ cat struct.c #include <stdio.h> #include <stdlib.h> #include <string.h> /*Declaration of structure*/ struct human { char *first; char gender; int age; } man,... (3 Replies)
Discussion started by: amit4g
3 Replies

3. UNIX for Dummies Questions & Answers

Storing pointer array in C

All .. I am having a pointer array . And trying to store the addess into that pointer array . please see below the problem i faced code: int cnt1; char *t_array; char *f_array; for(cnt1=0; cnt1<1000; cnt1++) { t_array =... (1 Reply)
Discussion started by: arunkumar_mca
1 Replies

4. Programming

pointer to structure example pls

Dear friends, First all I applogize for posting such a simple question , as I love this forum and forum participants thats why I am posting my problem here.. Why I am getting error when I remove the commented lines typedef unsigned int U; typedef struct {U c; U d;} vec32; ... (1 Reply)
Discussion started by: user_prady
1 Replies

5. Programming

How to return void function pointer

Hello all im trying to build function that will return void function pointer what is mean is ( not working ) the main function void * myClass::getFunction(int type){ if(type==1) return &myClass::Test1; if(type==2) return &myClass::Test2; } void myClass::Test1(){... (1 Reply)
Discussion started by: umen
1 Replies

6. Programming

Function pointer to inline function ?

Hi. Problem: I have to parse the payload of a packet. The payload could be in Big Endian Format (network byte order) or little. That depends on a flag present in the header of the packet. Solution: A horrible solution could be to check for that flag everytime I have to read a field in the... (11 Replies)
Discussion started by: emitrax
11 Replies

7. Programming

Function Returning Pointer

Hi guys. how a functions such fdopen, ... can return pointer? are these functions use static memory(variables)? (6 Replies)
Discussion started by: majid.merkava
6 Replies

8. Programming

help with char pointer array in C

i have an array like #define NUM 8 .... new_socket_fd = accept(socket_fd, (struct sockaddr *) &cli_addr, &client_length); char *items = {"one", "two", "three", "four", "five", "six", "seven", "eight"}; char *item_name_length = {"3", "3", "5", "4", "4", "3", "5", "5"}; ... (1 Reply)
Discussion started by: omega666
1 Replies

9. Programming

Unclear pointer and array

Hello, The purpose of the program is to print a sub string from the prompt inputs. I do not understand why char pointer does not work but char array will for line 40 and Line 41. ./a.out thisisatest 0 8 substring = "thisisat"And my code is: #include <stdio.h> #include <stdlib.h> #include... (29 Replies)
Discussion started by: yifangt
29 Replies

10. Programming

Pointer for 2D array seems to be 3D in C

I am struggling with the pointer to 2D-array (cf: 2D array of pointers). Can anybody help me elaborate how the pointer x moves in the memory to access the individual of y, especially the high lighted lines? I have talked to one of the curators of the forum, but I am still not quite clear. Here... (1 Reply)
Discussion started by: yifangt
1 Replies
semanage_node(3)					   Libsemanage API documentation					  semanage_node(3)

NAME
semanage_node - SELinux Network Nodes Management API SYNOPSIS
#include <semanage/node_record.h> #include <semanage/nodes_policy.h> #include <semanage/nodes_local.h> This object contains properties associated with a network node. For details on a specific function, see its manual page. Record API Overview semanage_node_create(3)- create a node semanage_node_free(3)- release resources for this node semanage_node_key_create(3)- create a key, which can be used to identify a node semanage_node_key_free(3)- release resources for this node key semanage_node_key_extract(3)- create a key matching this node semanage_node_clone(3)- create an identical node (deep-copy clone) semanage_node_compare(3)- compare this node to the provided key semanage_node_compare2(3)- compare this node to another Properties API Overview semanage_node_get_addr(3)- return the IP address of this node in string representation semanage_node_set_addr(3)- set the IP address of this node from the provided string representation and protocol semanage_node_get_addr_bytes(3)- return the IP address of this node as a byte array in network byte order semanage_node_set_addr_bytes(3)- set the IP address of this node from the provided byte array in network byte order semanage_node_get_mask(3)- return the IP mask of this node in string representation semanage_node_set_mask(3)- set the IP mask of this node from the provided string representation and protocol version semanage_node_get_mask_bytes(3)- return the IP mask of this node as a byte array in network byte order semanage_node_set_mask_bytes(3)- set the IP mask of this node from the provided byte array in network byte order semanage_node_get_proto(3)- return the IP protocol version for this node semanage_node_get_proto_str(3)- return a string representation of the given node protocol semanage_node_set_proto(3)- set the IP protocol version for this node semanage_node_get_con(3)- return the SELinux context associated with this node semanage_node_set_con(3)- set the SELinux context associated with this node Record Store API Overview semanage_node_modify_local(3)- add or update an interface in the local store semanage_node_del_local(3)- delete an interface from the local store semanage_node_exists(3)- check if an interface is defined in the persistent policy semanage_node_exists_local(3)- check if an interface is defined in the local store semanage_node_query(3)- query an interface in the persistent policy semanage_node_query_local(3)- query an interface in the local store semanage_node_count(3)- count the number of nodes defined in the persistent policy semanage_node_count_local(3)- count the number of nodes defined in the local store semanage_node_iterate(3)- execute a callback for each interface in the persistent policy semanage_node_iterate_local(3)- execute a callback for each interface in the local store semanage_node_list(3)- return an array containing all nodes in the persistent policy semanage_node_list_local(3)- return an array containing all nodes in the local store ivg2@cornell.edu 16 March 2006 semanage_node(3)
All times are GMT -4. The time now is 10:51 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy