I was hoping someone could help explain to me the difference of the following functions declarations especially those with pointers:
Code:void add_to_list(struct node **list, int n) void myFunc(char *a, char *b) void *myFunc(char *a, char *b) void *myStruct(char a[], int b) int Sum(int a, char b[]) void Sum(void)
How do you know when to return a value ??
How do you know when not to ??
(I know to use void when not returning a value)
What is happening with/in a function with a pointer to the function itself?? explain pointers to functions
(void *myFunc(char *a, char b)
explain what's happening with Pointers as arguments
explain pointers to pointersCode:void decompose(float x, int *int_part, float *frac_part) { *int_part = (int) x; *frac_part = x - *int_part; }
Code:void add_to_list(struct node **list, int n) /* what does the **list mean /?? */ { struct node *new_node; new_node = malloc(sizeof(struct node)); if (new_node == NULL) { printf("Error: malloc failed in add_to_list\n"); exit (EXIT_FAILURE); } new_node->value = n; new_node->next = *list; /* what is *list pointing to */ *list = new_node; }



LinkBack URL
About LinkBacks



