char c = 'A'; printf("%d\n",sizeof(c));// output = 1 printf("%d\n",sizeof('A')); // output = 4
Why does the sizeof operator give different output for a single character? Please, help
sizeof
c is a variable of type char ; its size is 1 byte.
c
char
'A' is an int literal - don't ask me why the standard says this. Its size is 4 bytes on your platform (same as sizeof(1) ).
'A'
int
sizeof(1)
Source: https://habr.com/ru/post/1239004/More articles:Swift AVPlayer will not be MP4 player: line play button - iosHow to successfully install pyproj and geodata? - pythonReducing an entire subtree with combix combix - reactjsRemoving duplicate data and loading into another table in SQL Server - sql-serverCannot access TCP server in universal Windows application - win-universal-appTabLayout with ViewPager does not work inside Android fragment - androidApache Installation Request - apacheHow to enable "gx" in Vim? Mine doesn't work anymore - vimBig O Notation for two non-nested loops - algorithmDynamic Height UITableView - iosAll Articles