The output of this snippet is 4 and 1. 4 is ok but why this 1 ????

#include<stdio.h>

int main()
{
        printf("%d %d",sizeof(NULL),sizeof(""));
        return 0;
}

Recommended Answers

All 2 Replies

Because "" represents the single null byte which always terminates a string in C.

ok got it, Thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.