in C programing language please help thanks Objectives Linking . Unix system too
ID: 3755699 • Letter: I
Question
in C programing language
please help
thanks
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 . . .
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.