Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
MemCpySetChar
//g++ 7.4.0 ////////////////////////////////////////////////////////////////////////////////MemCpySetChar // prototypes: void* memset (void* std,int val,size_t n); //void* memcpy(void* to,const void* from,size_t n); //void* memchr(void *str,int val,size_t n); //this code is created by Rezaul Hoque on July 11,2022; //contact:jewelmrh@yahoo.com;Dhaka,Bangladesh;https://rezaulhoque.wordpress.com,https://hoquestake.blogspot.com //note: codes shared by Rezaul Hoque on rextester are not for sale; they are created and shared to facilitate the algorithm learning process; many like Hoque use this platform to practice programming ;Rezaul hopes his contribution helps others to fine tune their learning; ///////////////////////////////////////////////////////////////////////////// #include <iostream> #include <string.h> int main() { char a[]="Hurray! Hurray! It's a holy, holiday."; char *r; char c[70]; r=(char*)memchr(a,'y',strlen(a)); if(r!=NULL) std::cout<<"1st occurrence of \'y\' is at "<<r-a+1; else std::cout<<"\'y\' is not found.\n"; memcpy(c,a,strlen(a)+1); std::cout<<"\nCopied string using memcpy():\n"<<c; memset(a,'*',7); std::cout<<"\nInitial string after memset():\n"<<a; return 0; }
run
|
edit
|
history
|
help
0
Breakfast Static Function
cppPyTeleAbs
project
Meeting Time
TmpFib
begin_end.cpp
<string> Indirect include of <errno.h> with gcc
ExceptionHandling1
Graph Theory On Strings
AWE