sizeof vs strlen() Type: Sizeof operator is a unary operator whereas strlen() is a predefined function in C. Data types supported: Sizeof gives actual size of any type of data (allocated) in bytes (including the null values) whereas get the length of an array of chars/string. Evaluation size: sizeof() is a compile-time expression giving you the size of a type or a variable’s type. It doesn’t care about the value of the variable. Strlen on the other hand, gives you the length of a C-style NULL-terminated string. Summary: The two are almost different concepts and used for different purposes.Instead of sizeof() for finding the length of strings or character arrays, just use strlen(string_name) with the header file #include <cstring> it's easier.