#include <stdio.h>
#define K 1024
/** (2pts)
* Copy the string in src to dst. Only copy as many characters
(including the
* null character) that are in src to dst. Points will be deducted
for copying
* too many or too few characters.
*/
void my_strcpy(char dst[], char src[])
{
}
int main(void)
{
char input[K+1], copy[K+1];
// Get a line of input (up to K number of bytes) into the 'input' string:
// Do not modify any of the following:
my_strcpy(copy, input);
printf("%s", copy);
return 0;
}
#include <stdio.h> #define K 1024 /** (2pts) * Copy the string in src to dst. Only copy as many characters (including the * null character) that are in src to dst. Points will be deducted for copying * too many or too few characters. */ void my_strcpy(char dst[], char src[]) { int i = 0; while(src[i]!='\0'){ dst[i] = src[i]; i++; } dst[i] = '\0'; } int main(void) { char input[K+1], copy[K+1]; // Get a line of input (up to K number of bytes) into the 'input' string: scanf ("%[^\n]%*c", input); // Do not modify any of the following: my_strcpy(copy, input); printf("%s", copy); return 0; }
Get Answers For Free
Most questions answered within 1 hours.