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 7773757
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T17:12:29+00:00 2026-06-01T17:12:29+00:00

I am trying to determine if every character in my string is alphanumeric. My

  • 0

I am trying to determine if every character in my string is alphanumeric. My compiler does not have the isalnum function.

My function is below and my_struct has a char array of size 6 (uint8 bom_pn[6]) ….and yes uint8 is a char.

boolean myfunc( my_struct * lh )
{
ret = ( isalphanum( lh->bom_pn ) && isalphanum( lh->bom_pn + 1 ) &&
        isalphanum( lh->bom_pn + 2 ) && isalphanum( lh->bom_pn + 3 ) &&
        isalphanum( lh->bom_pn + 4 ) && isalphanum( lh->bom_pn + 5 ) );
} 

My macro definition is below:

#define isalphanum(c) ( ( c >= '0' && c <= '9' ) ||  \
                        ( c >= 'A' && c <= 'Z' ) ||  \
                        ( c >= 'a' && c <= 'z' ) )

The above throws the error “operand types are incompatible (” uint8 * ” and ” int “)”

If I change my definition to the following, my code compiles and I get warnings.

#define isalphanum(c) ( ( (uint8)c >= '0' && (uint8)c <= '9' ) ||  \
                    ( (uint8)c >= 'A' && (uint8)c <= 'Z' ) ||  \
                    ( (uint8)c >= 'a' && (uint8)c <= 'z' ) )

Warning: “conversion from pointer to smaller integer”

My question is, how do I properly create this definition without warnings (and obviously check correctly).

Thanks

  • 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-06-01T17:12:31+00:00Added an answer on June 1, 2026 at 5:12 pm

    As you said lh->bom_pn is an array of bytes, which means it is effectively a pointer.

    So when you pass it to isalphanum, you’re passing a pointer, and comparing it to literal bytes.

    You have two options:

    1.)

    ret = ( isalphanum( lh->bom_pn[0] ) && isalphanum( lh->bom_pn[1] ) &&
            isalphanum( lh->bom_pn[2] ) && isalphanum( lh->bom_pn[3] ) &&
            isalphanum( lh->bom_pn[4] ) && isalphanum( lh->bom_pn[5] ) );
    

    2.)

    #define isalphanum(c) ( ( *(c) >= '0' && *(c) <= '9' ) ||  \
                            ( *(c) >= 'A' && *(c) <= 'Z' ) ||  \
                            ( *(c) >= 'a' && *(c) <= 'z' ) )
    

    Either one should fix your problem.

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

Sidebar

Related Questions

I'm trying to do something weird, I'm trying to determine how many methods has
I am trying to use regular expressions to determine what format the user have
I am trying to determine every single reference inside a dll with System.Reflection .
I’m trying to determine the relationship of a given compiler’s integer types’ sizes using
Trying to determine if it is possible to bind the SelectedValue of a ComboBox
I trying to determine display vertical size of my Blackberry Storm 2. I know,
I'm trying to determine how to count the matching rows on a table using
I'm trying to determine the window position of an application. I know SetWindowPos() would
I am trying to determine which implementation of the data structure would be best
I am trying to determine the best way to create a treeview list in

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.