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

Directions are below the pasted code #include <stdio.h> #include <string.h> char

ID: 3641683 • Letter: D

Question

Directions are below the pasted code


#include <stdio.h>
#include <string.h>

char * stoupper(char str[ ]);
char * myPuts(char str[ ]);

int main()
{
char str1[128];
char str2[128];

strcpy(str1, "Hello ");
strcpy(str2, "world!");

myPuts(str1);
printf(" is %d characters long. ", strlen(str1));
myPuts(str2);
printf(" is %d characters long. ", strlen(str2));
myPuts(strcat(str1,str2));
printf(" is %d characters long. ", strlen(str1));

myPuts(stoupper(str1));
printf(" is %d characters long. ", strlen(str1));


return 0;
}

char * stoupper(char str[ ])
{
int i = 0;

while(str[i] != '')
{
if (str[i] >= 'a' && str[i] <= 'z' )
str[i] = str[i] + ('A' - 'a');
i++;
}
return str;
}

char * myPuts(char str[ ])
{
int i = 0;

while(str[i] != '')
{
putchar(str[i]);
i++;
}
return str;
}


How would I modify stoupper and myPuts functions to use pointer notation
As well, how would I write and define my own version (not C's built in version) of the string copy, string length, and string concatenate functions.

Explanation / Answer

if you separated these into different questions I bet you would get more answers...your asking us to write quite a bit of code here... void strlength(char str1[]) { int i = 0; while(str1[i] != '') { i++ } return i; } //this is assuming that there is enough space in str1 to fit str2 void strcat(char str1[], char str2) { int i = 0; int j = 0; while (str1[i] != '') { i++; } i++; while(str2[j] != '') { str1[i] = str2[j]; i++; j++; } }

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