Answered! this is c programming Write code to define a function as follows: 1. function is named foo 2. foo takes a pointer to a character and returns…

this is c programming

Write code to define a function as follows: 1. function is named foo 2. foo takes a pointer to a character and returns an integer named x. 3. foo uses the pointer to check what it’s pointing to, if it is a character terminator, the functions returns an integer named x. 4. If not, foo counts by 1 if a call to an assumed function named, check1 returns 1. check1 requires one character argument and returns 0 or 1. You do not need to write the definition of check1; assume it’s already defined. 5. make sure to advance the pointer to the next character unless the terminator is found.

Don't use plagiarized sources. Get Your Custom Essay on
Answered! this is c programming Write code to define a function as follows: 1. function is named foo 2. foo takes a pointer to a character and returns…
GET AN ESSAY WRITTEN FOR YOU FROM AS LOW AS $13/PAGE
Order Essay

Expert Answer

 

It seems more details are required. nothing much has been told for x. Currently x is being assigned to count

The function is as follows:

int foo(char *p){

int count;
int x;
count = 0;
while (*p != ‘’){
if (check(*p) == 1){
count++;
}
p++;
}
x = count;
if (*p == ‘’)
return x;
}

Still stressed from student homework?
Get quality assistance from academic writers!