What is the output of the following progarm?
#include<stdio.h>
main( )
{
int x,y=10;
x=4;
y=fact(x);
printf(“%d\n”,y);
}
unsigned int fact(int x)
{
return(x*fact(x-1));
}
A. 24
B. 10
C. 4
D. none
Answers were Sorted based on User's Feedback
Answer / venu
ans:D.
when x= 1, x-1 =0, so total value = 0;
in fact() they are not checking if x==1 && x==0.
| Is This Answer Correct ? | 4 Yes | 3 No |
What is a null pointer in c?
Difference between data structure and data base.
7 Answers CTS, Value Labs, Zoho,
proc() { static i=10; printf("%d",i); } If this proc() is called second time, what is the output?
what would be the output of the following program main() { int a[] = {1,2,3,4,5}; int *ptr = {a,a+1,a+2,a+3,a+4}; printf("%d %d %d %d",a,*ptr,**ptr,ptr); } }
What is a function in c?
Explain bit masking in c?
Why is conio.h not required when we save a file as .c and use clrscr() or getch() ?
What is the size of structure pointer in c?
c program to add and delete an element from circular queue using array
What is the use of keyword VOLATILE in C?
How many levels of indirection in pointers can you have in a single declaration?
0 Answers Agilent, ZS Associates,
What is 'bus error'?