function is like that

move(from_vertex,to_vertex,auxiliary_vertex)

void move(int n, char A, char B, char C)

The above $2$ taken from your question proves that you want to transfer $A$ to $B$ using $C$

How tower of hanoi works?

- Move $n-1$ disks from $A \rightarrow C$ using $B$
- Move $n^{th}$ disk of $A$ to $B$
- Move all $n-1$ disks $C \rightarrow B$ using $A$

Code-:

#include<stdio.h>
void toh(int n,char from_peg,char to_peg,char via_peg)
{
if(n==1)
{
printf("MOVE DISK %d FROM %c TO %c\n ",n,from_peg,to_peg);
}
else
{
toh(n-1,from_peg,via_peg,to_peg);
printf("MOVE DISK %d FROM %c TO %c \n",n,from_peg,to_peg);
toh(n-1,via_peg,to_peg,from_peg);
}
}
int main()
{
int num;
printf("\n*****Tower of hanoi using 3 pegs*******\n");
printf("from peg A to peg B via peg C\n");
printf("enter the number of disks\n");
scanf("%d",&num);
toh(num,'A','B','C');
return 0;
}

Output-:

*****Tower of hanoi using 3 pegs*******
from peg A to peg B via peg C
enter the number of disks
3
MOVE DISK 1 FROM A TO B
MOVE DISK 2 FROM A TO C
MOVE DISK 1 FROM B TO C
MOVE DISK 3 FROM A TO B
MOVE DISK 1 FROM C TO A
MOVE DISK 2 FROM C TO B
MOVE DISK 1 FROM A TO B

Your issue -:

First of all your output is for the input transfer peg $A \text{to peg } C \text{via peg}B$

your issue in the code is

line 3rd

move (n-1, C, B, A);