Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7605285
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T00:07:48+00:00 2026-05-31T00:07:48+00:00

i have problems with the array function.. – i put my mac on fist

  • 0

i have problems with the array function.. –
i put my mac on fist line and then says me approved , but if is on 2st line rejected. my real one is B6 on end. /address down are not real../

in heder file settings >

#define CLIENTSNUMBER 2

BOOL Checking2(LPCSTR MacID);

cpp >

    char ClientMacs[CLIENTSNUMBER*1][18] = {
    "5A-77-77-97-87-B7",
    "5A-77-77-97-87-B6"
    };

BOOL Checking2(LPCSTR MacID)
{
    for(int x=0;x<CLIENTSNUMBER;x++)
    {
        if(!strcmp(MacID,ClientMacs[x])) 
             {
             MessageBoxA(NULL,MacID,"APPROVED!",MB_OK);
             return false;  
         }  else {
             MessageBoxA(NULL,MacID,"REJECTED!",MB_OK); 
             return false;
         }
    }
    return false;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T00:07:50+00:00Added an answer on May 31, 2026 at 12:07 am

    Because you return from your function (breaking out of your loop) when something matches or doesn’t match. It will never actually loop.

    Edit because it’s a slow morning:

    You need to go through the entire array and look at every element for a match before declaring it’s rejected:

    BOOL Checking2(LPCSTR MacID)
    {
        for(int x=0;x<CLIENTSNUMBER;x++)
        {
            if(strcmp(MacID,ClientMacs[x]) == 0) 
            {
                 MessageBoxA(NULL,MacID,"APPROVED!",MB_OK);
                 return false;  
            }  
        }
    
        MessageBoxA(NULL,MacID,"REJECTED!",MB_OK); 
        return false;
    }
    

    Also, do you really mean to return false in both cases? I would assume if you find a match it should return true

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some problems hiding my elements which are in an array. I put
I have problems with .stringify() , but I think my JavaScript array must be
I have problems with marshalling output parameter of c++ function returning array of data
I’m working on a multi dimensions array but i have a problem Imagine I
I have two basic Cpp tasks, but still I have problems with them. First
I have some problems using two dimensional array. static const int PATTERNS[20][4]; static void
i'm working on a project and i have some problems.I have searched but can
I'm Using CakePHPs standard Auth mechanism, but I have some problems with that. Everytime
I have a problem with my autoloader: public function loadClass($className) { $file = str_replace(array('_',
I have a PHP function that returns an array. This is the output of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.