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] != '