Question
C programming problem please help my computer crashed
what is the output of each program ?
(c) #include <stdio.h> int main() { /* main */ int f3, t = 9; int func3 (int x); printf(Inside main, t = $d\n, t); f3 - fun
0 0
Add a comment Improve this question Transcribed image text
Answer #1

c. Answer (code output):

Inside main, t = 9
Inside func3, x = 9
Inside main, f3 = 9

Explanation (explained with comments in comments):

#include <stdio.h>

int main()

{ /* main */

      int f3, t = 9; // intializing t with 9

      //declaring func3 function

      int func3 (int x);

      //printing t value which is 9

      printf("Inside main, t = %d\n", t);

      //calling func3 and saving the return value to f3

      f3 = func3(t);

     

      //printing f3 which is a return value of func3

      printf("Inside main, f3 = %d\n", f3);

      return 0;

      /*main*/

}

int func3(int x)

{/*func3*/

    //printing the input parameter of function and returning the same

    printf("Inside func3, x = %d\n", x);

    return x;

}/*func3*/

d. Answer (code output):

This code will not compile

Explanation:

#include <stdio.h>
int main()
{ /* main */
   int f4, t = 9; // intializing t with 9

   //declaring func4 function
   int func4 (int x);
   //printing x value which is not declared in main method
   printf("Inside main, x = %d\n", x);

   //calling func4 and saving the return value to f4
   f4 = func4(t);

   //printing f4 which is a return value of func4
   printf("Inside main, f4 = %d\n", f4);
   return 0;
   /*main*/
}
int func4(int x)
{/*func4*/
//printing the input parameter of function and returning the same
printf("Inside func4, x = %d\n", x);
return x;
}/*func4*/

Add a comment
Know the answer?
Add Answer to:
C programming problem please help my computer crashed what is the output of each program ?...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • What is the output of the following c program. Why, Can you tell me how do...

    What is the output of the following c program. Why, Can you tell me how do you solve it? #include <stdio.h> int fun(int n) { if(n==0) { return 1; } else return 7 + fun(n-2); } int main() { printf("%d", fun (4)); return 0; | }

  • OPERATING SYSTWM Question 31 What is the output of this C program? #include #include void main()...

    OPERATING SYSTWM Question 31 What is the output of this C program? #include #include void main() int mptr, *cptr mptr = (int*)malloc(sizeof(int)); printf("%d", "mptr); cptr = (int)calloc(sizeof(int),1); printf("%d","cptr); garbage 0 000 O garbage segmentation fault Question 8 1 pts If this program "Hello" is run from the command line as "Hello 12 3" what is the output? (char '1'is ascii value 49. char '2' is ascii value 50 char'3' is ascii value 51): #include<stdio.h> int main (int argc, char*argv[]) int...

  • Please help me with this question (in C programming language and Unix) computer system book 3 edi...

    please help me with this question (in C programming language and Unix) computer system book 3 edition int *fun (int *x)f int value *xtt return &value; int main) int pl; int **p2; int a; char str [5] printf ("Enter a number:") scanf("%d", a) ; printf ("Enter a line:") gets (str); p1-malloc(sizeof (int)) *pl-p2; p2-malloc(sizeof (int)); pl-fun (a); n-0; for (pl-stripl<-str+5;pl++) if (isdigit (pl)) at+; return 0; Construct a table that shows for each line of code, what may be the...

  • I need the programming to be in language C. I am using a program called Zybook...

    I need the programming to be in language C. I am using a program called Zybook Prompt: Write a statement that outputs variable numObjects. End with a newline. Given: #include <stdio.h> int main(void) { int numObjects; scanf("%d", &numObjects); return 0; } What I did so far. I am not sure if its right tho? #include <stdio.h> int main(void) { int numObjects; scanf("%d", &numObjects); printf(" num Objects is "); printf("%d\n", userAge); return 0; }

  • In C language 5. What is the OUTPUT of each of these programs? If you aren't...

    In C language 5. What is the OUTPUT of each of these programs? If you aren't confident of an answer, type mpile and run the program to test it. (a) <stdio.h> #include int main main int count; int sum0; for (count 1; count10; count++) sum sum+ count; for count printf("sum= %d\n", return 0; sum); )main (b) #include int main ) <stdio.h> main/ int count; int sum -0 for (count 1 count10; count 2) sum sum + count; for count print...

  • 10 What does the last printf in this code print to the screen? a)n-7 b)n- 0...

    10 What does the last printf in this code print to the screen? a)n-7 b)n- 0 c)n--1 d) None of the above 鬐include< stdio. h> int main) int n-0 for (n-7: n<O; n-- printf (n") printf ("n *%d", n); - return 11-What does the code print to the screen? 鬐include< stdio.h> void fun (int) int main) b) 8 d) None of the above fun (3) return void fun (int a) int x-10 while(a !_ 3 x > s} if a...

  • Convert the C program into a C++ program.Replace all C input/output statements with C++ statements (cin,...

    Convert the C program into a C++ program.Replace all C input/output statements with C++ statements (cin, cout, cin.getline) . Re-make the func function by the following prototype: void func( double, double &); #include int user_interface(); double func(double); void print_table(); int main (int argc, char *argv[]) {    print_table(user_interface());    return 0 ; } int user_interface(int val){    int input = 0;    printf("This function takes in x and returns an output\n");    printf("Enter Maximum Number of X:");    scanf("%d", &input);...

  • Please answer the above queston (in terms of C programming) and explain answer Semester 2 &...

    Please answer the above queston (in terms of C programming) and explain answer Semester 2 & Trimester 3B, 2015 COMP1004 Engineering Programming Question 3 - Repetition (20 marks) Q3(a) What will be printed when the following code is executed? (5 marks] #include <stdio.h> int main() int i, j; for(i=1;i<17;i=i+2) { printf("%d==", i); for(j=i; j>0;j--) printf("#"); printf("\n"); return 0; == # 3 = = # # # 5 == ### ## 7 #### #

  • What is the output of the following program? Show each step  to get to the output #include...

    What is the output of the following program? Show each step  to get to the output #include <stdio.h> int f(int* a, int* b); int main() {        int a = 6, b = 7, c = 8;        b = f(&c, &a);        printf("a = %d, b = %d, c = %d\n", a, b, c);           return 0; } int f(int* a, int* b) {        *a = *a + *b;        *b = *a - *b;        printf("a = %d,...

  • I'm having trouble understanding pointers in my c programming class. I posted the pointer assignment below....

    I'm having trouble understanding pointers in my c programming class. I posted the pointer assignment below. If you could leave comments pointing out where pointers are used it would be much appreciated! ----------------------------------------------------------------------------------------------------------------------------------- Write a complete C program for an automatic teller machine that dispenses money. The user should enter the amount desired (a multiple of 10 dollars) and the machine dispenses this amount using the least number of bills. The bills dispenses are 50s, 20s, and 10s. Write a...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT