Answer:
The code to this question can be defined as follows:
int count(int *first, int *last)//defining a method count that accepts two integer pointer
{
int c=0;//defining integer variable c
while (first <= last)//defining a while loop that counts first to last value
{
if (*first < 0)//use if block to check negative value
c++;//increment variable value
first++;//increment first parameter value
}
return c;//return c value
}
Step-by-step explanation:
In this code, a method "count" is declared that accepts two pointer variable "first and last" as the parameter, inside the method an integer variable "c", and a while loop is declared that counts values, and inside this an if block is used that counts the negative value and increment its value, and also increments the first parameter value, and return c value.