Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Given the code below, write the body of the two functions copyl using array nota

ID: 3843147 • Letter: G

Question

Given the code below, write the body of the two functions copyl using array notation and py2 using pointer notation. #include #define SIZE 10 void copy1(char * const s1, const char * const 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 ", string1) char string3[SIZE];//create array string3 char string4[] = "Good Bye";//Create an array containing a string copy2(string3, string4); printf("string3 = %s ", string3);}

Explanation / Answer

#include<stdio.h>
#define SIZE 10

void copy1(char * const s1, const char * const s2)
{
   int i;
   for(i=0;i<strlen(s2);i++)
       s1[i] = s2[i];
  
}

void copy2(char *s1, const char *s2)
{
   s1 = *s2;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote