Run ❯
Get your
own
website
×
Change Orientation
Change Theme, Dark/Light
Go to Spaces
#include
int main() { // Reserve 20 bytes of memory for a string char myString[20] = "Hello World!\0"; int memorySize = sizeof(myString); int stringSize; // Print the string and use %n to measure it printf("%s%n\n", myString, &stringSize); // Print the size of the string printf("Memory size: %d\n", memorySize); printf("String size: %d\n", stringSize); return 0; }
Hello World!
Memory size: 20
String size: 12