Translations of this page?:

data

Składnia:

    #include <string>
    const char *data();

Funkcja data() zwraca wskaźnik do pierwszego znaku w aktualnym stringu.

Przykład:

#include <iostream>
#include <string>
using namespace std;
 
int main ()
{
    string str1="hello";
    const char *ch;
    size_t n=str1.length();
    ch=str1.data();
    for(int i=0;i<=n;i++)
    {
        cout<<*(ch++);
    }
    return 0;
}

Powiązane tematy: String_operators, c_str

 
• • • IndeksOstatnie zmianyRSScc