TCS
Company
4. What is the output for the following program
#include
main()
{
char a[5][5],flag;
a[0][0]='A';
flag=((a==*a)&&(*a==a[0]));
printf("%dn",flag);
}
Read Solution (Total 3)
-
- Error will be occur.because,header file is not to printf,function should return a value.
- 12 years agoHelpfull: Yes(1) No(2)
- The out put is 1n.
in the 0th palce of a we store 'A';
and if check firstly a==*a which mwan we check indirectly the first palce data which is 'A' which is true so its return 1.
after && we check the sane value which is also 'A' this is again return 1.
in computer lanuage 1&&1 means 1 which assign by flag variable.
so output is 1n.
here we see to exprestion a and *a which both indicate 0th place value - 12 years agoHelpfull: Yes(0) No(2)
- if required header files are included then ans is 0(a==*a is false)
- 12 years agoHelpfull: Yes(0) No(1)
TCS Other Question