Hi I want to ask about casting in C.

If I have a struct c in which contains 2 integers a and b, and I want cast it to a char array, so I did this
Code:
typedef struct{
char a;
int b;
}c;

main(){
char* ch;
c c1;
c* pter = (c*)malloc(sizeof(c));
c* revert = (c*)malloc(sizeof(c));

pter = &c1;
pter->a = 5;
pter->b=6;
ch = (char)pter;

revert = (c*)t;
printf("priting revert c.a is %d",revert->a);
printf("priting revert c.b is %d",revert->b);
}
When I tried to revert back to c struct and access the values of a and b I encounter some access reading violation reading location error.
Any ideas what is wrong here? is this the way to do it?