Sponsored Content
Top Forums Programming pass a pointer-to-pointer, or return a pointer? Post 302274084 by Corona688 on Tuesday 6th of January 2009 03:25:01 PM
Old 01-06-2009
I can't see any effective difference aside from the extra complications of effectively returning two values in your first example. I'd tend to avoid that kind of redundancy in case my fumble fingers ever cause one to contradict the other.
 

10 More Discussions You Might Find Interesting

1. Programming

pointer

void main() { int a={1,2,3,4,5,6,7,8,9,10}; int *p=a; int *q=&a; cout<<q-p+1<<endl; } The output is 10, how? if we give cout<<q it will print the address, value won't print.... if we give cout<<p it will print the address, value won't print.... p has the base addr; q... (1 Reply)
Discussion started by: sarwan
1 Replies

2. Programming

Regarding char Pointer

Hi, char *s="yamaha"; cout<<s<<endl; int *p; int i=10; p=&i; cout<<p<<endl; 1) For the 1st "cout" we will get "yamaha" as output. That is we are getting "content of the address" for cout<<s. 2) But for integer "cout<<p" we are getting the "address only". Please clarify how we are... (2 Replies)
Discussion started by: sweta
2 Replies

3. Programming

pointer problem

could any one tell why the following is showing segmentation fault while using **ptr but working fine using **a #include<stdio.h> ... (1 Reply)
Discussion started by: useless79
1 Replies

4. Programming

far pointer

what is far pointer in C (1 Reply)
Discussion started by: useless79
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

matrix pointer

Can anyone tell me what the following statements do? float (*tab); tab=(float (*)) calloc(MAXCLASS, (MAXCLASS+1)*sizeof(float)); (3 Replies)
Discussion started by: littleboyblu
3 Replies

7. Programming

Pointer Arithmetic In C

I have a fundamental question on C pointer arithmetry.. Suppose i have a c string pointer already pointing to a valid location, Can I just do a charptr = charptr +1; to get to the next location, irregardless if my program is 32 or 64 bits? or should i do it this way: charptr =... (1 Reply)
Discussion started by: Leion
1 Replies

8. Programming

Pointer to pointers

Hi guys, I'm trying to understand pointers in C and made a simple example and I've problems with It. Can someone help? #include <stdio.h> #include <stdlib.h> #include <assert.h> int f1(char **str_); int main(int argc, char **argv) { char *str = NULL; f1(&str); ... (3 Replies)
Discussion started by: pharaoh
3 Replies

9. 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

10. Programming

Segmentation fault when I pass a char pointer to a function in C.

I am passing a char* to the function "reverse" and when I execute it with gdb I get: Program received signal SIGSEGV, Segmentation fault. 0x000000000040083b in reverse (s=0x400b2b "hello") at pointersExample.c:72 72 *q = *p; Attached is the source code. I do not understand why... (9 Replies)
Discussion started by: jose_spain
9 Replies
sigsend(2)							System Calls Manual							sigsend(2)

NAME
sigsend(), sigsendset() - send a signal to a process or a group of processes SYNOPSIS
DESCRIPTION
The system call sends a signal to a process or a group of processes. The process or group of processes to which the signal is to be sent is specified by id and idtype. The signal to be sent is specified by sig and is either one from the list given in (see signal(2)) or 0. If sig is equal to zero (the null signal), error checking is performed but no signal is actually sent. This can be used to check the validity of id and idtype. The real or effective user ID of the sending process must match the real or effective user ID of the receiving process, unless the process has appropriate privileges, or sig is and the sending process has the same session ID as the receiving process. idtype and id work together as follows: o If idtype is sig will be sent to the process with a process ID equal to o If idtype is sig will be sent to any process with a process group ID equal to o If idtype is sig will be sent to any process with a session ID equal to o If idtype is sig will be sent to any process with an effective user ID equal to o If idtype is sig will be sent to any process with an effective group ID equal to o If idtype is sig will be sent to all processes and id will be ignored. o If id is the value of id is taken from the calling process. The process with a process ID of is always excluded. The process with a process ID of is included only if idtype is equal to provides an alternate interface for sending signals to a set of processes. psp is a pointer to a structure that includes the following members: idop p_op; idtype_t p_lidtype; id_t p_lid; idtype_t p_ridtype; id_t p_rid; The structure defines a set of processes as the result of a set operation (difference, union, intersection, or exclusion) on two operands (idtype/id pairs). The left (right) operand is specified by and takes the values specified by id and takes the values specified by idtype in the system call defined above. p_op specifies the operand, and takes one of the following values: Set difference. The resultant set consists of the processes that are in the left operand and not in the right operand. Set intersection. The resultant set consists of the processes that are in both the left and right operands. Set union. The resultant set consists of the processes that are in either the left or right operand or both. Set exclusive The resultant set consists of the processes that are in either the left or right operand but not in both. RETURN VALUE
Upon successful completion, returns a value of Otherwise, it returns a value of -1 and sets to indicate the error. ERRORS
If fails, it sets errno (see errno(2)) to one of the following values: [EINVAL] sig is neither a valid signal number nor zero. [EINVAL] idtype is not a valid value. [EINVAL] sig is idtype is and id is [ESRCH] No process can be found corresponding to that specified by id and idtype. [EPERM] The user ID of the sending process is not 0, and its real or effective user ID does not match the real or effective user ID of the receiving process, and the calling process is not sending to a process that shares the same session ID. SEE ALSO
kill(2), signal(2). sigsend(2)
All times are GMT -4. The time now is 08:07 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy