For PM Review
For PM Review
File************************************************************
program1: program1.c
clang program1.c my_string.c -o program1
clean:
rm -rf *.o
clobber: clean
rm -rf program1
***************************************my_string.h*********************************
***************************
***************************************my_string.c*********************************
***************************
#include "my_string.h"
size_t2 index = 0 ;
while (str[++index] != '\0');
return index;
}
size_t2 my_strlen2 (const char *str) {
const char* s;
for (s = str; *s; ++s) ;
return (s - str);
while(str2[j]!='\0')
{
str1[i] = str2[j];
i++;
j++;
}
str1[i]='\0';
return str1;
}
while(*str2)
{
*str1 = *str2;
str1++;
str2++;
}
*str1='\0';
return str1;
}
}
return 0;
}
}
return 0;
}
***************************************program1.c**********************************
**************************
#include <stdio.h>
#include <string.h>
#include "my_string.h"
int main() {
/* CIT 593 students: TODO: add code to test your my_string.h functions */
// reset str1
strcpy(str1, "Baba");
my_strcat(str1,str2);
printf ("string's concatination : my_strcat() = %s \n",str1 );
// reset str1
strcpy(str1, "Baba");
my_strcat2(str1, str2);
printf ("string's concatination : my_strcat2() = %s \n",str1 );
return 0;
}
***************************************program2.c**********************************
**************************
#include <stdio.h>
#include <string.h>
#include "my_string.h"
int main() {
// a stirng to be tested
char str[100]="Hello World";
printf("original string : %s\n",str);
***************************************program3.c**********************************
**************************
#include <stdio.h>
#include <string.h>