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

in C programing language please help thanks Objectives Linking . Unix system too

ID: 3755699 • Letter: I

Question

in C programing language
please help
thanks

Objectives Linking . Unix system tools main.c char si[3"abc" char s2[3]: char s313] static int count-l; int rev (char s0) int copy (char s) int main int i,j i-copy (s1) count++i j-rev (s1) return 0 Q1) Write the code of the following source files in a folder named "Q1". Then include them n your report. i. main.c: contains the code shown above. i. copy.c: Contains the definition of the "copy" function that will copy the input a. parameter "s" to the global sting "s2". Then calls the "print" function. i. rev.c: Contains the definition of the "rev" function that will copy the input parameter g "3 in the reverse order. Then calls the "print" function. iv. print.c: Contains the definition of the "print" function that will display the string given as a parameter s" 11Page

Explanation / Answer

#include<stdio.h>

//global variable declarations

char s1[]="abc";

char s2[3];

char s3[3];

static int count=1;

//method to print array

void print(char s[])

{

int i=0;

while(s[i]!='')

printf("%c",s[i++]);//printing array char by char

printf(" ");

}

int copy(char s[])

{

//copies s to global variable s2

int i=0;

while(s[i]!='')

s2[i]=s[i++];//copying char by char

//printing s2 after copying

printf("S2:");

print(s2);

return 1;

}

int rev(char s[])

{

//copies s to global variable s3 in reverse order

int i=0;

while(s[i]!='')i++;//ifnding lenght of s

int k=0;

while(--i>=0)

{

s3[k++]=s[i];//copying char by char in reverse order

}

//printing s3 after copying

printf("S3:");

print(s3);

return 1;

}

int main()

{

int i,j;

i = copy(s1);

count++;

j =rev(s1);

return 0;

}

//PLS give a thumbs up if you find this helpful, its helps alot, thanks

output:

S2:abc
S3:cba


Process exited normally.
Press any key to continue . . .