Please find the code below::
#include <stdio.h>
typedef int (*Pf) (int);
//define function
//it will return number*10
int function(int i){
return i*10;
}
//apply button
int apply(Pf functionPointer,int N){
return functionPointer(N);
}
int main()
{
//pointer to function
Pf pointer = function;
int i = apply(pointer,20);
//should print 200
printf("%d",i);
return 0; //terminating
}
output:
Assume the following type definition … typedef int (*Pf) (int) ; Write a C function apply such...
code in C language ADT: typedef struct{ int ID; float salary; int age; }Employee; Specification: In this lab, five functions need to be implemented using the given ADT. 1. Employee* readRecord(FILE*) This function receives a FILE pointer created before. It reads a line from the provided csv file, and creates an Employee struct pointer with the information from that line then returns the pointer back to the calling function. Each line in the provided csv file contains the id, salary,...
C++
Checkpoint 11.33 Look at the following structure definition: struct Date int month int day int year, Write the prototype for a function called getlnput that accepts a pointer to a Date structure as a parameter. Type your program submission here. Checkpoint 11.28 Look at the following structure definition struct Rectangle int length int width Write the definition of a pointer to a Rectangle structure called rectPtr and assign it the value nullptr Fype your progzam submission heze
Write a C function with signature btbstree (int' post, int size) that gets the post-order traversal of a binary search tree in the form of an int array, reconstructs the tree and returns a pointer to the tree root as output (The second input parameter size specifies the number of elements in the tree). Note: Type bt is defined in the following way: typedef struct btreenode { struct btreenode *left; int data; struct btreenode *right; |}bt;
**Bonus Question** Write a C function with signature bt' bstree (int' post, int size) that gets the post-order traversal of a binary search tree in the form of an int array, reconstructs the tree and returns a pointer to the tree root as output (The second input parameter size specifies the number of elements in the tree). Note: Type bt is defined in the following way: typedef struct btreenode { struct btreenode *left; int data; struct btreenode "right; bt;
In C++ Write a function int * return_matches(int a[], int & size,TEST t) which returns an array (allocated off of the heap in the function) containing only the elements of array a that pass the “test” t. The function iterates through all the elements of a, and constructs a new array containing all the elements that pass the test. When the parameter corresponding to “size” is passed in (by reference), it contains the size of the array a. In the...
**Bonus Question Write a C function with signature bt' bstree (int' post, int size) that gets the post-order traversal of a binary search tree in the form of an int array,reconstructs the tree and returns a pointer to the tree root as output (The second input parameter size specifies the number of elements in the tree). Note: Type bt is defined in the following way: typedef struct btreenodel struct btreenode *left; int data; struct btreenode *right; }bt; 12pt Paragraph B...
Write a function definition for a function my_strcmp() with the
following header:
Write/Implement a function definition for a function my_strcmp () with the following header: int my_strcmp (const char *s1, const char *s2) This function compares the string pointed to by s1 to the string pointed to by s2. If the string pointed to by s1 comes before the string pointed to by s2 in dictionary ordering, then -1 is returned. If the string pointed to by s1 is the...
() Given the following structure definition and typedef for a linked list of strings: typedef struct node st node; struct node st { char *word; /* a valid string pointer or NULL */ node *next; /* next node in the list or NULL */ }; Write a C function, free list(), that takes as an argument one of these lists, possibly NULL, and frees all the strings as well as the list itself. Write robust code. void free list(node *list){
Complete the definition of the following function void find_two_largest (int 3[), int n, int *largest, int * second_largest); When passed an array a of length n, the function will search a for its largest element and second largest element, storing them in the two variables pointed to by largest and second_largest, respectively. Test your function in the main function.
1. After the declaration: typedef struct { int part1; int part2; } Foo; Group of answer choices Foo is a new data type which can be used to declare variables of this new type that holds two integers Foo is a variable which holds a pointer to this new type that holds two integers Foo is a variable which holds this new type that holds two integers None of the above choices are correct 2. After the declaration: typedef struct...