05-25-2004
Regarding Function and Pointers.
HI,
Here is some thing that is puzzling me from a long time.
Can some body explain me this with example.
The question is :-
What is the difference between function pointer and pointer to a function.
Where do we actually use the function pointers and pointer to functions.
Thanks in Advance.
10 More Discussions You Might Find Interesting
1. Programming
I am pondering the next question:
Can I safely sare objects that have virtual functions (i.e. have
virtual function table pointers) between two processes ?
Where will the pointers point to in each process ?
What I am afraid of is that in the creating process the pointer
will indeed point to... (2 Replies)
Discussion started by: Seeker
2 Replies
2. Programming
hi all,
let say i have a pointer exit, and this exit will store some value. how can i store the value that the pointer points to into an array and then print them out from the array.
thanks in advance (2 Replies)
Discussion started by: dianazheng
2 Replies
3. Programming
is this a valid c declaration
int (*ptr(int *b));
plz explain... (4 Replies)
Discussion started by: areef4u
4 Replies
4. Programming
Hi I mash with pointers in C. I solve this problem about 5 hours and I don't know how I should continue.
void InsertFirst (tList *L, int val) {
tElemPtr new;
if((new = malloc(sizeof(tElemPtr))) == NULL) Error();
new->data = val;
new->ptr = L->frst;
L->frst = new;... (2 Replies)
Discussion started by: Milla
2 Replies
5. Programming
Hi all. I am trying to use restricted pointers to allow the gcc compiler optimize the code, but I have not been able to make it work so far. I am testing with this code:
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include <sys/time.h>
void vecmult(int n, int * restrict a, int... (0 Replies)
Discussion started by: carl.alv
0 Replies
6. UNIX for Advanced & Expert Users
I am new to shared pointer conceot in C++ and hence require some clarification:
For example:
class A
{
public:
virtual ~A()
{
}
int x;
};
typedef boost::shared_ptr<A>... (1 Reply)
Discussion started by: uunniixx
1 Replies
7. Programming
I have a special character called ô. When it is declared as a character variable its showing it can be printed. But when it is declared as a character pointer variable its showing it cannot be printed. I am just wondering why its happening like this..
c1 = '@';
c2 = 'ô';
char *fp;
fp="XXô";
if... (1 Reply)
Discussion started by: sivakumar.rj
1 Replies
8. Programming
Hello forum memebers
As iam new to C++ programming i am little bit confuse to understand the function pointers.
Please help me to understand the function pointers with examples are suggest me good site for this,Its better if it have picturial representation ie any PPTS available in Google.... (2 Replies)
Discussion started by: rajkumar_g
2 Replies
9. Programming
Hello, I read from a book exercise for a challenge. How to print out each letter of char array a by two different pointers pa and ppa in the example?
I have tried my code for letter "r" by testing without full understanding as only the first one worked.
#include<stdio.h>
int main()
{
char... (17 Replies)
Discussion started by: yifangt
17 Replies
10. Programming
I am attempting to create an array of function pointers. The examples I follow to do this are from:
support.microsoft.com/en-us/help/30580/how-to-declare-an-array-of-pointers-to-functions-in-visual-c
... (3 Replies)
Discussion started by: spflanze
3 Replies
LEARN ABOUT SUNOS
alphasort
scandir(3UCB) SunOS/BSD Compatibility Library Functions scandir(3UCB)
NAME
scandir, alphasort - scan a directory
SYNOPSIS
/usr/ucb/cc [ flag... ] file...
#include <sys/types.h>
#include <sys/dir.h>
int scandir(dirname, namelist, select, dcomp);
char *dirname;
struct direct *(*namelist[]);
int (*select(.),(*dcomp)();
int alphasort(d1, d2);
struct direct **d1, **d2;
DESCRIPTION
The scandir() function reads the directory dirname and builds an array of pointers to directory entries using malloc(3C). The second param-
eter is a pointer to an array of structure pointers. The third parameter is a pointer to a routine which is called with a pointer to a
directory entry and should return a non zero value if the directory entry should be included in the array. If this pointer is NULL, then
all the directory entries will be included. The last argument is a pointer to a routine which is passed to qsort(3C), which sorts the com-
pleted array. If this pointer is NULL, the array is not sorted.
The alphasort() function sorts the array alphabetically.
RETURN VALUES
The scandir() function returns the number of entries in the array and a pointer to the array through the parameter namelist. The scandir()
function returns -1 if the directory cannot be opened for reading or if malloc(3C) cannot allocate enough memory to hold all the data
structures.
The alphasort() function returns an integer greater than, equal to, or less than 0 if the directory entry name pointed to by d1 is greater
than, equal to, or less than the directory entry name pointed to by d2.
USAGE
The scandir() and alphasort() functions have transitional interfaces for 64-bit file offsets. See lf64(5).
SEE ALSO
getdents(2), malloc(3C), qsort(3C), readdir(3UCB), readdir(3C), lf64(5)
NOTES
Use of these functions should be restricted to applications written on BSD platforms. Use of these functions with any of the system
libraries or in multithreaded applications is unsupported.
SunOS 5.10 3 Jan 2002 scandir(3UCB)