Skip to content

Instantly share code, notes, and snippets.

@kasramp

kasramp/test.cpp Secret

Created August 1, 2020 23:34
Show Gist options
  • Save kasramp/f4a981172e7f80053b9c5a7fb8d137dd to your computer and use it in GitHub Desktop.
Save kasramp/f4a981172e7f80053b9c5a7fb8d137dd to your computer and use it in GitHub Desktop.
#include<cstring> //In C++ with C++ style;
#include<cstdlib> //Includes atoi function;
int main(int argc, char *argv[]) {
string *s1;
string *s2;
int z;
strlen(s1); // returns length of s1
strcat(s1,s2); // concatenate s2 to end of s1, s1 then will hold s1+s2
strcpy(s1,s2); // copy content of s2 into s1, then s2==s1
strncpy(s1,s2,X); // copy X first character of s2 into s1
z=atoi(s1); // converts string s1 to int z, atof is used for converting to double and atol is used for converting to long. If string does not have any number then it returns 0
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment