Winnie Pooh Girl
New member
שאלה ב- c
אני צריכה לכתוב את הפונקציה הבאה:
Write a filter function FILTERING with the following specification:
Receives 3 arguments: an array of pointers (to char*), the size of the array, and a pointer "f" to a function that receives a char* argument and returns int.
The pointer to a function of this type is declared as follows: int (*func)(char*);
Description:FILTERING applies the function pointed to by "f" to each of the elements of the array, and prints the elements for which the function returns a number greater than 4.
וזה מה שניסיתי לעשות:
void filtering (char* pointers[] , int size, int(*func)(char*)f ){
int i;
int num;
for (i=0; i<size; i++){
num=f (pointers);
if (num>4)
printf("printing %s ", pointers);
}
}
רציתי לדעת בבקשה איפה הטעות וכיצד אני יכולה לעשות את הפונקציה הזאת.
תודה רבה!
אני צריכה לכתוב את הפונקציה הבאה:
Write a filter function FILTERING with the following specification:
Receives 3 arguments: an array of pointers (to char*), the size of the array, and a pointer "f" to a function that receives a char* argument and returns int.
The pointer to a function of this type is declared as follows: int (*func)(char*);
Description:FILTERING applies the function pointed to by "f" to each of the elements of the array, and prints the elements for which the function returns a number greater than 4.
וזה מה שניסיתי לעשות:
void filtering (char* pointers[] , int size, int(*func)(char*)f ){
int i;
int num;
for (i=0; i<size; i++){
num=f (pointers);
if (num>4)
printf("printing %s ", pointers);
}
}
רציתי לדעת בבקשה איפה הטעות וכיצד אני יכולה לעשות את הפונקציה הזאת.
תודה רבה!