/**** Program to find the sizeof string literal ****/
#include<stdio.h>
int main(void)
{
printf("%d\n",sizeof("a"));
/***The string literal here consist of a character and null character,
so in memory the ascii values of both the characters (0 and 97) will be
stored respectively which are found to be in integer datatype each
occupying 4 bytes. why is the compiler returning me 2 bytes instead of 8 bytes?***/
return 0;
}
Output:
2