cpp-optimizations/02-pass-by-ref/no-ref.cpp

21 lines
252 B
C++
Raw Permalink Normal View History

2022-06-17 12:48:09 +00:00
#include <cstdlib>
struct A
{
char str[16];
};
int len(struct A a)
{
int count;
for(count = 0; a.str[count] not_eq '\0'; ++count);
return count;
}
int main()
{
struct A a = { .str = "Hello, World!" };
int res = len(a);
return EXIT_SUCCESS;
}