TCS
Company
Programming
Technical
Predict the output of following code:
main()
{
printf(“FACE”+2); // valid skip specified number of
//characters from start
}
1. FACE
2. FA
3. CE
4. Garbage value
Read Solution (Total 10)
-
- Here FACE is considered as 4 characters so starts from 0,1,2,3 here +2 represents at the position 2 so from position 2 CE are present and it prints as CE
- 6 years agoHelpfull: Yes(6) No(0)
- answer will be.... CE
- 6 years agoHelpfull: Yes(1) No(1)
- CE counting +2 from left
- 6 years agoHelpfull: Yes(0) No(1)
- May be it's ce
- 6 years agoHelpfull: Yes(0) No(0)
- HOW does it works?
- 6 years agoHelpfull: Yes(0) No(0)
- CE because it will skip 2 char
- 6 years agoHelpfull: Yes(0) No(0)
- Ce
Opition3;since it printf print from right to left - 6 years agoHelpfull: Yes(0) No(0)
- option 3
Ignores first two characters - 6 years agoHelpfull: Yes(0) No(0)
- answer will be .... CE
- 5 years agoHelpfull: Yes(0) No(0)
- it must be CE because +2 means printf start printing from index number 2
- 5 years agoHelpfull: Yes(0) No(0)
TCS Other Question