Sponsored Content
Top Forums Programming difference between int ** func() and int *& func() Post 91776 by linuxpenguin on Monday 5th of December 2005 01:34:31 PM
Old 12-05-2005
do you have linux installed. if yes try to use the cdecl utility

this is what i get

cdecl> explain int * *p()
declare p as function returning pointer to pointer to int
cdecl> explain int * &p()
Warning: Unsupported in C -- 'reference'
declare p as function returning reference to pointer to int
cdecl>

so int **func() is a function that returns a pointer to a pointer to int and int * & func() is a function that returns an reference to a pointer to a function, and as seen above the second statement is not supported in C, you can try it in c++ tho.
 

7 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Utilizing func keys in scripts

I would like to have the function keys available to me in my scripts. Anyone have any ideas on how to map these to functionality I design? :confused: (3 Replies)
Discussion started by: fjjlee
3 Replies

2. Shell Programming and Scripting

FLOOR Func

Hello Experts, Is there any inbuild FLOOR function to do FLOOR func in mathmetics in awk script like in FlOOR Func in C. Ex:- floor(2.9) = 2 floor(2.1) = 2 floor(2.0) = 2 floor(-2.0) = 2 floor(-2.1) = -3 floor(-2.9) =... (1 Reply)
Discussion started by: user_prady
1 Replies

3. UNIX for Dummies Questions & Answers

int open(const char *pathname, int flags, mode_t mode) doubt...

hello everybody! I want to create a file with permissions for read, write, and execute to everybody using C, so I write this code: #include <stdio.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> int main(){ int fileDescriptor; fileDescriptor =... (2 Replies)
Discussion started by: csnmgeek
2 Replies

4. Red Hat

Video: Spotlight on FUNC

</p>Download this video: Ogg Theora] FUNC is the brainchild of Michael DeHaan, Adrian Likins, Seth Vidal, and Greg DeKoenigsberg. In this edition of Spotlight On, Michael, Adrian, and Seth discuss how FUNC makes it easy to write commands across large numbers of machines remotely and... (0 Replies)
Discussion started by: Linux Bot
0 Replies

5. Programming

Handle int listen(int sockfd, int backlog) in TCP

Hi, from the manual listen(2): listen for connections on socket - Linux man page It has a parameter called backlog and it limits the maximum length of queue of pending list. If I set backlog to 128, is it means no more than 128 packets can be handled by server? If I have three... (3 Replies)
Discussion started by: sehang
3 Replies

6. Shell Programming and Scripting

Advanced AWK Regexp substring to int & Replace

Hi! I have a difficult problem, to step up a unknown version number in a text file, and save the file. It would be great to run script.sh and the version gets increased. Example the content of the textfile.txt hello version = x bye This include three steps 1. First find the char after... (2 Replies)
Discussion started by: Beachboy72
2 Replies

7. Shell Programming and Scripting

Bash shell script: Str(007) to int(7),increment it(8) & convert back to string(008)

Hi, I have the following requirement. There will be following text/line in a file (eg: search-build.txt) PRODUCT_VERSION="V:01.002.007.Build1234" I need to update the incremental build number (eg here 007) every time I give a build through script. I am able to search the string and get... (4 Replies)
Discussion started by: drwatson_droid
4 Replies
SL(3)                                                              SL Reference                                                              SL(3)

NAME
sl - a small and flexible linked list implementation DESCRIPTION
`sl' provides a generic implementation of singly-linked lists and stacks. `sl' does not do extra allocations behind the scenes for placeholder nodes, yet users of the library can define their node structure almost any way they want. The one important thing is that the ->next member is the first member of the structure. FUNCTIONS
void *sl_push(void *root, void *p) Push "p" onto the list "root". Return the new list. void *sl_pop(void *root) Pop a node from a list. Return the pop'ed item, or NULL if the list is empty. Note: this function takes a pointer to a pointer to a node as its argument. C does not allow "void **" to be used as a generic pointer to pointer type. However, since "void *" is a generic pointer, it can also point to a pointer to pointer. void *sl_unshift(void *root, void *p) Shift a node onto the `far end' of a list. This function can be used to append a list to another. The new list is returned. void *sl_shift(void *) Shift a node from the `far end' of a list. Returns the item shifted off the list, or NULL if the list is empty. Note: this function takes a pointer to a pointer to a node as its argument. C does not allow "void **" to be used as a generic pointer to pointer type. However, since "void *" is a generic pointer, it can also point to a pointer to pointer. void *sl_reverse(void *root) Returns the reversed list. void *sl_map(void *root, int (*func)(void *, void *), void *data) Map a function, "func", to every element in a list. The "data" is handed to "func" along with each node. This function can be used for a sequential search of a list of nodes. This function returns NULL on normal operation. If "func" returns non-zero, a pointer to the current node will be returned. void *sl_filter(void *root, int (*func)(void *, void *), void *data) "func" is called once for each node in the list, having the node itself passed as the first argument; "data" is passed as the second argument. If "func" returns a positive value the current node will be extracted from the passed-in list and stored in a temporary list. When we get to the end of the passed-in list, the temporary list is returned. If "func" returns a negative value the same happens as when a positive value is returened but in addition any further traversal of the passed-in array is terminated and the current temporary list is returned immediately. You can return the first 5 elements that matches a certain criteria by maintaining a counter in "data" and return 1 until the fifth node is found, then return -1. Note: this function takes a pointer to a pointer to a node as its argument. C does not allow "void **" to be used as a generic pointer to pointer type. However, since "void *" is a generic pointer, it can also point to a pointer to pointer. void *sl_split(void *root) Split a list roughly on the middle; return a pointer to the second half. void *sl_merge(void *p1, void *p2, int (*cmp)(void *, void *)) Merge two sorted lists and keep the list sorted. This function is the heart of the mergesort routine. Thanks to CB Falconer for this code. void *sl_mergesort(void *root, int (*cmp)(void *, void *)) Return the sorted list. int sl_count(void *p) Returns the number of elements in a list. void sl_free(void *root, void (*func)(void*)) A macro that just calls sl__free(). This is necessary because sl_free() is a defined function on OS-X. void sl__free(void *root, void (*func)(void*)) Free a list of nodes. Takes an optional argument, @p func, used to free the node if it is defined. AUTHOR
Stig Brautaset <stig@brautaset.org> CREDITS
Thanks to Thomas Stegen of comp.lang.c for suggesting the "void*" trick employed in `sl_pop()` and `sl_shift()`. Thanks to CB Falconer of comp.programming for help on the sorting code. Richard Spindler suggested what became the "sl_filter()" function. COPYRIGHT
Copyright (C) 2003,2004,2005 Stig Brautaset This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. POD ERRORS
Hey! The above document had some coding errors, which are explained below: Around line 58: =cut found outside a pod block. Skipping to next block. simplelist 0.3.4 2006-12-21 SL(3)
All times are GMT -4. The time now is 07:12 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy