cp-geeks-adgitm / Hacktoberfest

Everyone is free to contribute. Not eligible for Hacktoberfest
GNU General Public License v3.0
32 stars 95 forks source link

Added Character Count code #277

Open areebamuzammil opened 1 year ago

cpgeeksadgitm commented 1 year ago

@areebamuzammil IT throws me the error. Could you tell where I can test, or please review the code

g++ /tmp/OzHyZHdkRV.cpp
/tmp/OzHyZHdkRV.cpp: In function 'int main()':
/tmp/OzHyZHdkRV.cpp:19:5: error: 'strcpy_s' was not declared in this scope; did you mean 'strcpy'?
   19 |     strcpy_s(string_array, str1.c_str());
      |     ^~~~~~~~
      |     strcpy

I am testing on https://www.programiz.com/cpp-programming/online-compiler/

areebamuzammil commented 1 year ago

@areebamuzammil IT throws me the error. Could you tell where I can test, or please review the code

g++ /tmp/OzHyZHdkRV.cpp
/tmp/OzHyZHdkRV.cpp: In function 'int main()':
/tmp/OzHyZHdkRV.cpp:19:5: error: 'strcpy_s' was not declared in this scope; did you mean 'strcpy'?
   19 |     strcpy_s(string_array, str1.c_str());
      |     ^~~~~~~~
      |     strcpy

I am testing on https://www.programiz.com/cpp-programming/online-compiler/

@cpgeeksadgitm Hi, actually strcpy_s() is a security-enhanced version of strcpy(). I'm not sure if online compilers support this function, but it is working fine on MS-VS22. You can replace strcpy_s() with strcpy() to check the rest of the working of program on online compiler you mentioned.

cpgeeksadgitm commented 1 year ago

@areebamuzammil Great, that's worked like a charm. But could you please replace that in the original PR, it will make it easy for the new programmer?