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';
}

Subscribe to take the course

The course is free. Sign in with Telegram and subscribe to the channel to open every lesson.

Sign in another way