c - what is the difference this two type of function declaration? -
i'm reading book on info construction in c.
i saw code in exercise,
this construction declaration.
typedef struct node { int data; struct node *next; }node;
the function declaration, head of tree..
node * create (int n); // please explain
create function
but can write this?
int create (int n);
which 1 utilize , advantage of former declaration of function?
c allows homecoming pointer function!
to so, can declare this..
int * myfunction(int n) {. . .}
means take integer n
parameter , homecoming pointer of type int
.
note :
point remember that, not thought homecoming address of local variable outside of function have define local variable static variable.
like,
int * myfunction(int n) { static int m[10] .... homecoming m; }
coming question...
node * create (int n);
means function create take integer parameter n
, homecoming pointer node
.
so use,
node * create (int n);
homecoming pointer , int create (int n);
homecoming integer!! hope helps!!
c data-structures
No comments:
Post a Comment