::
C Language Interview
Questions
::
|
|
|

Click
on >> (Arrow for More Questions)
|
|
| |
Answer/Explaination
:
(blank space)
irl
rl
l
(Exp):
Here a string (a pointer to char) is initialized with a value
"girl". The
strlen function returns the length of the string, thus n has a value
4. The
next statement assigns value at the nth location ('\0') to the first
location.
Now the string becomes "\0irl" . Now the printf statement
prints the string
after each iteration it increments it starting position. Loop starts
from 0 to
4. The first time x[0] = '\0' hence it prints nothing and pointer
value is
incremented. The second time it prints from x[1] i.e "irl"
and the third time
it prints "rl" and the last time it prints "l" and
the loop terminates.
|
|
| |
Next
>> |
|
| |
Quick
Links
| Home |
C Language | All
India Entrances | Previous Year
Papers | Software Projects |
| Project Reports |
Job Alerts & Notifications |
Technical Interview Questions |
| Audio Visual Notes
|
|
|