What are differences between sizeof operator and strlen function?

sizeof is keyword of c which can find size of a string constant including null character but strlen is function which has been defined in a header file named string.h and can find number of characters in a string excluding null character. Most probably it is used to compare the size of string with some conditions.
 
Example:-
 
#include<string.h>
void main(){
    int a,b;
    a=strlen("itorian");
    b=sizeof("itorian");
    printf("%d  %d",a,b);
    getch();
}

Comments

Popular posts from this blog

Customize User's Profile in ASP.NET Identity System

Migrating database from ASP.NET Identity to ASP.NET Core Identity