Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Both 14 and 15 please What is output of the following program? #include int b =

ID: 3810802 • Letter: B

Question

Both 14 and 15 please What is output of the following program? #include int b = 4, c = 3; void f (void) {int b = 5: b++; printf("%d %d ", b, c);} int main (void) {int b = 2; c++; f(); printf ("%d %d ", b, c);} a) 53 24 b) 64 24 c) 63 24 d) 64 64 Let f be the following function: int f (char *s, char *t) {char *p1, *p2; for (p1 = s; *p1 != ''; p1++) {for (p2 = t; *p2 ! = ''; p2++) if (*p1 == *p2) break; if (*p2 '') break;} return p1 - s;} What is the return value of f("babcd", "dabbe')? a) 0 b) 2 c) 3 d) 4 e) 5

Explanation / Answer

Solution1.c

#include <stdio.h>//header file
int b=4,c=3;//global variables
void f(void)
{//function name f
   int b=5;//local variables of function
   b++;// post incrementing
   printf("%d %d ",b,c);//output function printf
}
int main()
{//it return integer
    b=2;
    c++;// post incrementing
    f();//function calling
    printf("%d %d ",b,c);

    return 0;
}


output

6 4                                                                                                                                                                      

2 4

Solution2.c

#include <stdio.h>//header file

int f(char *s,char *t)
{//function definition
   char *p1,*p2;//pointers *p1,*p2

   for(p1=s;p1!='';p1++){
         for(p2=t;p2!='';p2++)
   if(*p1==*p2)
   break;
   if(*p2=='')
   break;

}
printf("%d",(p1-s));//output function
return p1-s;//return value
}
int main()
{//main function which returns integer
f("babcd","dabbe");//calling function

return 0;
}


output

5

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote