Q. What is the difference between sizeof operator and strlen operator?
Ans:- Sizeof operator measure the length of the string including null character whereas strlen measures the size of the string without null character.
For example: - printf(“%d”, strlen(“abc”));
Output=3
Printf (“%d”, sizeof (“abc”));
Output=4

No comments:
Post a Comment