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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T13:53:23+00:00 2026-05-25T13:53:23+00:00

I have made a program that is supposed to check whether a number is

  • 0

I have made a program that is supposed to check whether a number is positive, negative, or zero.
When I try to compile the code, it gives a improper operand type error, for line 28, which is the cmp opcode. Am I formatting it wrong, or is there some other problem here?

#include <stdio.h>

int input;
int output;


int main (void)
{
       scanf("%d", &input);

__asm
{
    jmp start

negative:   
    mov ebx, -1
    ret
nuetral:
    mov ebx, 0
    ret
positive:
    mov ebx, 1
    ret

start:
    mov eax, input
    mov ebx, other

    cmp 0, eax

    jl negative
    je neutral
    jg positive

    mov output, ebx

}
printf("%d\n", output);
}
  • 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-25T13:53:24+00:00Added an answer on May 25, 2026 at 1:53 pm

    The first operand of the cmp instruction must be a register or a memory location, not an immediate value. You need to use cmp eax, 0 instead. This would also be consistent with your conditional jumps (jl would jump if eax is negative, etc.).

    You may be confusing Intel assembly syntax (which you used) with AT&T syntax, where the order of operands is reversed.

    Additionally, your usage of ret is incorrect: ret is used to return from a function, but there is no function call here. What you need there is a jmp to the mov output, ebx line.

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

Sidebar

Related Questions

I have a pointer of a structure type that I made. On program start
I have made a java GUI program and have added a jList on that
I have a problem.... I made a java program that does the following: BufferedReader
I have made a program that finds and measures the radius of yeast colonies
My C++ is a little rusty but I have made a program that reverses
I have made a demo small program that I want to deliver to my
I have made a program that divides without any arithmetic characters, here is the
I have made a program that reads voltage and current values of some diode
I have made program that detects the face now what i have to do
I have made a program in Java that calculates powers of two, but it

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.