sizeof is evaluated by the compiler where as strlen is evaluated at runtime.Examples 1. int len = sizeof(“akamai”) - 1;
2. Char a[] = “akamai”; int len = sizeof(a) - 1;
3. Char *a = “akamai”; don’t use sizeof, please use strlen(a);
No comments:
Post a Comment