Skip to content

Instantly share code, notes, and snippets.

@oshingc
Created November 21, 2014 13:29
Show Gist options
  • Save oshingc/5c2c7ad77529442e62d1 to your computer and use it in GitHub Desktop.
Save oshingc/5c2c7ad77529442e62d1 to your computer and use it in GitHub Desktop.
C++ Functions
STRING TO CHAR[]
string tmp = "cat";
char tab2[1024];
strcpy(tab2, tmp.c_str());
ARRAY TO SET
std::set<T> set(begin(array), end(array));
int arr{} = {1,55,4,2,35,1,5}; //declare the array
int arrSize = sizeof(arr)/arr[0]; //get size of the array
set<int> s(arr, arr+arrSize); //move the array to the set ***
STRING TO INT
atoi( str.c_str() )
std::stoi( str )
INT TO STRING
std::string s = std::to_string(42);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment