请帮我找到问题 [英] plz help me find the problem

查看:109
本文介绍了请帮我找到问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

extern char received_msg[BUFFER_SIZE];
extern char voters_id[BUFFER_SIZE];


#define BUFFER_SIZE 100


void compare_votes(void)
{
    char id1[]="v1";
    char id2[]="v2";
    unsigned int count1=0, count2=0;

    if(!strcmp(received_msg,id1))
        {count1++;}
    if(!strcmp(received_msg,id2))
        {count2++;}
    
}
void compare_id(void)
{
        int i;
        char received =0;
        for (i=0; i<=voters; i++)
        {
            if(v[i].flag==0)
                {
                if (!strcmp(voters_id,v[i].voter_ID))
                    {
                        v[i].flag=1;
                        compare_votes();
                        received =1;
                    }
                }
        if (received==1)
            break;
        }
}

推荐答案

您没有问过一个问题,我通常不会打扰回答.但是,一件事像拇指酸痛一样伸出来.

如果要在声明中使用#define,请在使用它之前确保已定义它.

干杯,



PS:您正在使用很多未包含在上面的示例中的全局变量,因此很难遵循.以及难以保养的可怜杯子,都会随您而来.
As you haven''t asked a question I wouldn''t have normally bothered answering. However one thing sticks out like a sore thumb.

If you''re going to use a #define in a declaration then make sure it''s defined before you use it.

Cheers,

Ash

PS: You''re using a lot of globals you haven''t included in the sample above which makes it hard to follow. As well as hard to maintain for the poor mug that comes after you.


这篇关于请帮我找到问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆