I need to implement my own set of functions
which perform standard string handling functions
(such as strcpy, strcmp, etc) using array, ptr, malloc...

Started writing the first part with someone's help but I'm having difficulty...
Just began to learn C language so need your help please.
Please give me some ideas as to how I should arrays and ptr
to write these functions. thank u.

/* String package */

#include <stdlib.h>
#include <stdio.h>
#include "mystring.h"

const int EXTRA_SPACE = 10;


/* (1) perform strcpy function */
String NewString(char *s)
{
int originalString;
originalString = length(s);

char *myPtr;
myPtr= malloc (originalString + 1 + EXTRA_SPACE);


for(int i=0; i <= originalString; i++){
myPtr[i] = s[i]; }

String myString = malloc(size_of(struct String));
myString->ptr = myPtr;
myString->arraySize = originalString + 1 + EXTRA_SPACE;

return myString;
}

int length(char *ptr){
}

/* (2) deletes all dynamic storage associated with "string" */
void DeleteString(String string){}

/* (3) return a character at index */
char char_at(String string, int index){
}

/* (4) eg. "programming" substring(string,3,7) return "gram" */
String substring(String string, int start, int finish){
}

/* (5) compare string1 n string2, if string1 is lexicographically
less than string2, return an integer <0. greater then interger>0,
the same return 0 */
int compare(String string1, String string2){
}

/* (6) concantenate string1 and string2 and return a ptr to the new String */
String concat(String string1, String string2){
}

/* (7) return the length of string, "programming" return 11 */
int length(String string){
}

/* (8) return a ptr to a C-style string containing a copy of string */
char *StringChars(String string){
}