So I want to convert this C language program to Assembly:

  void main
  {
    int year;
    printf("Enter the year: ");
    scanf("%d",&year);

     if(year%400 ==0 || (year%100 != 0 && year%4 == 0))
    {
        printf("Year %d is a leap year",year);
    }
    else
    {
        printf("Year %d is not a leap year",year);
    }
  }

Can you help me figure out how it is mapped in Asm? I tried to convert it using this link: http://assembly.ynh.io/ but I'm having an error: Error: Command failed: /tmp/test683852013.c:2:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘{’ token

I would gladly appreciate your help. Thanks.

Recommended Answers

All 2 Replies

some compilers have an option to produce an assembly code. What compiler do you use?

just insert () after void main

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.