Skip to content
Quiz · Strings and Arrays · lesson 2 of 6

Quiz — a string_view of a temporary string

What happens when you build and run this program?

C++
#include <iostream>
#include <string>
#include <string_view>

std::string make_name() {
    return "Ada";
}

int main() {
    std::string_view name = make_name();
    std::cout << name << '\n';
}