char& front() - JanKulbaga/String-CPP GitHub Wiki

char& front()

Returns a reference to the first character of the string. This function shall not be called on empty strings.

Example

#include <ostream>
#include "src/String.h"

int main()
{
    String s = "Hello World";
    char& c = s.front();
    std::cout << c;
    return 0;
}

Output:

H

Parameters

None

Return value

A reference to the first character in the string.

⚠️ **GitHub.com Fallback** ⚠️