Write the implementations of functions copy1 and copy2 for copying strings. copy1 uses array index notation. copy2 uses Pointers and Pointer Arithmetic. #include #define SIZE 10 void copy1(char* s1, const char* s2); // prototype void copy2(char* s1, const char* s2); // prototype int main(void) { char string1[SIZE]; // create array string1 char *string2 = "Hello"; // create a pointer to a string copy1(string1, string2); printf("string1 = %s\n", string1); char string3[SIZE]; // create array string3 char string4[] = "Good Bye"; // create an array containing a string copy2(string3, string4); printf("string3 = %s\n", string3); } void copy1(char* s1, const char* s2) { //Implement copying string using array index notation } void copy2(char* s1, const char* s2) { //Implement copying string using Pointers and Pointer Arithmetic }
Write the implementations of functions
copy1 and copy2 for copying strings. copy1 uses array index notation. copy2 uses Pointers and
Pointer Arithmetic.
#include <stdio.h>
#define SIZE 10
void copy1(char* s1, const char* s2); // prototype
void copy2(char* s1, const char* s2); // prototype
int main(void)
{
char string1[SIZE]; // create array string1
char *string2 = "Hello"; // create a pointer to a string
copy1(string1, string2);
printf("string1 = %s\n", string1);
char string3[SIZE]; // create array string3
char string4[] = "Good Bye"; // create an array containing a string
copy2(string3, string4);
printf("string3 = %s\n", string3);
}
void copy1(char* s1, const char* s2)
{
//Implement copying string using array index notation
}
void copy2(char* s1, const char* s2)
{
//Implement copying string using Pointers and Pointer Arithmetic
}
![](/static/compass_v2/shared-icons/check-mark.png)
Step by step
Solved in 4 steps with 2 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![C How to Program (8th Edition)](https://www.bartleby.com/isbn_cover_images/9780133976892/9780133976892_smallCoverImage.gif)
![Database Systems: Design, Implementation, & Manag…](https://www.bartleby.com/isbn_cover_images/9781337627900/9781337627900_smallCoverImage.gif)
![Programmable Logic Controllers](https://www.bartleby.com/isbn_cover_images/9780073373843/9780073373843_smallCoverImage.gif)