scanf输入不知道哪块有些问题

qzjhjxj ###### 问题遇到的现象和发生背景

#include 
#include 
/* run this program using the console pauser or add your own getch, system("pause") or input loop */

#define MVNum 100
typedef char VerTexType;
typedef int ArcType;
typedef struct{
    VerTexType vexs[MVNum];
    ArcType arcs[MVNum] [MVNum];
    int vexnum,arcnum;
}AMGraph;

int LocateVex(AMGraph *G,VerTexType v){
    int i;
    for(i=0;ivexnum;i++){
        if(G->vexs[i]==v)
            return i;
    }
    return -1;
}

int CreateUDN(AMGraph *G){
    int i,j,k;
    VerTexType v1,v2;
    printf("输入总点数:");
    scanf("%d",&G->vexnum);
    printf("\n输入总边数:");
    scanf("%d",&G->arcnum);
    printf("\n输入顶点信息:");
    scanf("%s",G->vexs);
    
    for(i=0;ivexnum;i++){
        for(j=0;jvexnum;j++)
            G->arcs[i][j]=0;
    }
    for(k=0;karcnum;k++){
        printf("\n输入一条边依附的两个顶点:");
        scanf("%c%c",&v1,&v2);
        //printf("\n%c%c\n",v1,v2);
        i=LocateVex(G,v1);
        j=LocateVex(G,v2);
        G->arcs[i][j]=1;
    }
    printf("OK"); 
}




int main(int argc, char *argv[]) {
    AMGraph G;
    CreateUDN(&G);
    return 0;

}




运行结果及详细报错内容

img

help me@qzjhjxj

scanf("%c%c",&v1,&v2);之前,加个getchar(),接收前面scanf输入时的换行符。而且在两个%c之间加个空格,因为你输入时两个字符之间也是加空格的,必须一致