i was wondering how to delete an element or replace an element from a linked list

check any of the thousands of explanations on how to implement a linked list that exist.
Basically just point the element before the one that is to be deleted to the one that the element you're deleting is pointing to and set the pointer in that element to null.

typedef struct ll {
  int val;
  ll *next;

ll *list;

void addElement(int el) {

void deleteElement(int pos) {
 // find position
 // ...
 ll element = (listCopy->next)*;
 ll delElement = (element->next)*;
 element.next = delElement.next;
 delElement.next = null;

or something like that, my pointer code in C is a bit rusty.