#include <stdio.h>
#include <string.h>
int main()
{
void *str = "Hello";
printf("%1d %1d\n ",strlen(str),sizeof(str));
return 0;
}
5,8
Explanation
strlen returns the size of the string i.e. "Hello" takes 5bytes
sizeof gives the size allocated for the datatype, In our case a pointer is allocated 8bytes
No comments:
Post a Comment