TCS
Company
Programming
Program
what will be the o/p of the program
void main()
{
int const * p=5;
printf("%d",++(*p));
}
Read Solution (Total 10)
-
- Error ...
We cannot modify a constant variable... Here *p is a const variable which always holds 5 only... We cannot modify that... - 10 years agoHelpfull: Yes(25) No(2)
- 6
it's not giving a compiler error because firstly we find value of p at pointer location after this we increment like this
*p=5++
6 - 10 years agoHelpfull: Yes(1) No(2)
- error
we can't convert 'int' to 'const int *' - 10 years agoHelpfull: Yes(1) No(0)
- int const *p means that p is a pointer variable that is pointing to a constant variable.so while changing the variable value by deferring gives an error!
- 10 years agoHelpfull: Yes(1) No(0)
- it will be error
- 10 years agoHelpfull: Yes(1) No(0)
- error because p is constant cannot be modified
- 10 years agoHelpfull: Yes(0) No(0)
- 5,p is declared as constant so its value will not change.
- 10 years agoHelpfull: Yes(0) No(0)
- plz give me right answer admin
- 10 years agoHelpfull: Yes(0) No(0)
- comile error
- 8 years agoHelpfull: Yes(0) No(0)
- #include
int main()
{
int N1=7,N2=24,i,sum=0;
for(i>0;i7)
{
sum=sum+i;
}
}
printf("%d",sum);
} - 5 years agoHelpfull: Yes(0) No(0)
TCS Other Question