152k views
2 votes
The C language allows developers to pass functions as parameters to other functions. Provide a declaration for a function named garnet that accepts two parameters. The first parameter shall be character, and the second parameter shall be a function that accepts one argument and returns an integer. The Garnet function shall return nothing.

User Mslowiak
by
3.9k points

1 Answer

3 votes

Answer:

answer is given below

Step-by-step explanation:

Declaration for garnet

  • void garnet(char,int (*f)(int));
  • void - garnet return nothing

garnet accepts two parameters

  1. 'Char'
  2. function

Function as a parameter

  • int (*f) (int))

and here

first int refers return type of function

  • (*f) function as pointer variable

second int

  • arguments that accept by inner function- function as a parameter

so here Garnet is a function that accepts two parameters. One parameter that contains the character and another parameter that takes an argument (here I am taking an integer) and returns an integer. Function The function returns nothing. Zero is mentioned here.

User Helen
by
3.8k points