C++ da string olarak pointer oluşturamıyorum oluyormu acaba oluyor ise nasıl oluyor cevaplarsanız memnun olurum <3
Follow along with the video below to see how to install our site as a web app on your home screen.
Not: This feature may not be available in some browsers.
Evet oluyor, fakat pek tercih edilen bir yöntem değil.C++ da string olarak pointer oluşturamıyorum oluyormu acaba oluyor ise nasıl oluyor cevaplarsanız memnun olurum <3
int main() {
std::string hebele = "bu bir pointerdir";
char* p = &hebele[0];
std::cout << p << std::endl;
return 0;
}
teşekkür ederim aklımda kaldı pek kullanılmayan olsana bilmekte fayda var iyi akşamlarEvet oluyor, fakat pek tercih edilen bir yöntem değil.
string değişkeninizin başına char* ekleyerek pointer oluşturabilirsiniz.
Örnek:
C++:int main() { std::string hebele = "bu bir pointerdir"; char* p = &hebele[0]; std::cout << p << std::endl; return 0; }