Answers for "what is >> and << in cpp"

C++
2

what is -> in c++

/**
 * @author Charles Salvia (StackOverflow)
 *
 * -> is to access a member function or member variable of an object through
 * a pointer, as opposed to a regular variable or reference.
 */

// For example: with a regular variable or reference, you use the . operator
// to access member functions or member variables.  
std::string s = "abc";
std::cout << s.length() << std::endl;

//But if you're working with a pointer, you need to use the -> operator:
std::string* s = new std::string("abc");
std::cout << s->length() << std::endl;
Posted by: Guest on April-05-2021
0

how to use and in c++

The ampersand symbol & is used in C++ as a
reference declarator in addition to being the address operator.
  The meanings are related but not identical. If you take the address 
  of a reference, it returns the address of its target. Using the previous 
  declarations, &rTarg is the same memory address as &target .
Posted by: Guest on December-06-2021

Code answers related to "what is >> and << in cpp"

Browse Popular Code Answers by Language