+ 4
What is the difference between sizeof operator and strlen operator
6 Réponses
+ 2
but /0 is used to declare only the end of the string then y it consider /0 as a value..
+ 3
M.MANIVANNAN \0 is used to declare end of string and hence in strlen , it is not calculated...
coming back to sizeof, as variable hold that character also, size changes and it should be calculated in sizeof... check with some dummy variable of size 81 and you won't be allowed to store more than 80 characters as one is reserved for \0.... now, if you do sizeof, it's 81 as 80 characters you set and one for null character
+ 2
strlen operator is used for find the string length,and sizeof operator is used for find the byte size 😎
+ 1
strlen operator is used for find the string length and the size of operator of ator is they declared the operator size I mean the size of is a key word.
0
size of shows the space required to store a specific variable's data. strlen shows how many characters are in a specific string variable, which may be any number from 0 to the allocated string length.
0
The function sizeof() is a unary operator in C language and used to get the size of any type of data in bytes.
The function strlen() is a predefined function in C language.This is declared in "string.h" header file.It is used to get the length of array or string.
Hope you got the answer..!!😉
Cheers👍