AI Features

Discussion: Sizing Up Some Characters

Execute the code to understand the output and gain insights into array size determination and function parameter behavior.

Run the code

Now, it’s time to execute the code and observe the output.

C++
#include <iostream>
void serialize(char characters[])
{
std::cout << sizeof(characters) << "\n";
}
int main()
{
char characters[] = {'a', 'b', 'c'};
std::cout << sizeof(characters) << "\n";
std::cout << sizeof(characters) / sizeof(characters[0]) << "\n";
serialize(characters);
}

Understanding the output

...