Search
 
SCRIPT & CODE EXAMPLE
 

CPP

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;
Comment

>> c++

std::cout, << is used to write to standard output
std::cin,  >> is used to read from standard input.
Comment

PREVIOUS NEXT
Code Example
Cpp :: str remove char c++ 
Cpp :: max in c++ 
Cpp :: c++ get the line which call a function 
Cpp :: check prime cpp gfg 
Cpp :: unordered_set to vector 
Cpp :: card validator c++ 
Cpp :: how to split string into words c++ 
Cpp :: c++ contains 
Cpp :: c detect os 
Cpp :: stack implementation through linked list 
Cpp :: how to turn int into string c++ 
Cpp :: struct c++ 
Cpp :: what is meant by pragma once in c++ 
Cpp :: how to cout in c++ 
Cpp :: vector library c++ 
Cpp :: c++ finding gcd 
Cpp :: transformer in nlp 
Cpp :: cpp #include "" < 
Cpp :: Subarray with given sum in c++ 
Cpp :: c ++ split_string 
Cpp :: vector of threads thread pool c++ 
Cpp :: how to sort array in c++ stockoverflow 
Cpp :: initialise 2d vector in c++ 
Cpp :: how to access a vector member by its index 
Cpp :: makefile for single cpp file 
Cpp :: find the graph is minimal spanig tree or not 
Cpp :: intersection between vector c++ 
Cpp :: declare empty array in c++ 
Cpp :: c++ swap function 
Cpp :: educative 
ADD CONTENT
Topic
Content
Source link
Name
1+9 =