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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T05:48:23+00:00 2026-06-01T05:48:23+00:00

I am trying to learn assembly my self, and I have been reading different

  • 0

I am trying to learn assembly my self, and I have been reading different websites first to know the meaning of some registers, if-the, etc, and saw examples on how to use them.

However I don’t find it easy to understand. This program finds certain letters and counts them in a board using a bidimensional array. I want to replace the part of the functions void print_results(), and void count() with assembly code since this is very easy in regular C code.

I am not sure how to start so I am more interested on just a good start, specially on how to pass the variable from void read_board() to the function void count() to count the letters found, after that I think I can be on my own.

I appreciate any help, Thank you.

#include <stdio.h>

FILE *inputFilePtr;
char board[7][7];

void usage() {
    printf("usage: one filename argument.\n");
}

void read_board() {
    int i, j;
    for (i=0; i != 7; i++) {
        for (j=0; j != 7; j++) {
            fscanf(inputFilePtr, "%c", &board[i][j]);
        }
        fscanf(inputFilePtr, "\n");
    }
}

void count() {

     __asm__("\
      ");

}

void print_results() {

}

int main(int argc, char**argv) {
    if (argc != 2) {
        usage();
        return 1;
    }

    inputFilePtr = fopen(argv[1], "r");
    if (inputFilePtr == NULL) {
        printf("Couldn't open file, %s\n", argv[1]);
        return 1;
    }

    read_board();

    count();

    print_results();

    return 0;
}
  • 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-01T05:48:25+00:00Added an answer on June 1, 2026 at 5:48 am

    I am assuming you want the C-equivalent that does your current asm part.

    Since you array board is global and your board size is fixed (7×7), you don’t need pass anything to count(). This will do:

    void count() {
    int i, j, count = 0;
    char = 'X'; //Replace with whatever char you want to count 
    
      for (i=0; i != 7; i++) {
            for (j=0; j != 7; j++) {
              if(board[i][j] == c)
                 count++;
           }
       }
    }
    

    Then simply call count() from wherever you want.

    In case if you want to know how to pass parameters to functions (if the board, i & j are not global like your case):
    call count as: count(&board[0][0], int i, int j);

    Receive the parameters as: void count(char **board, int i, int j)

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

Sidebar

Related Questions

I am trying to learn assembly from scratch. I have been reading up quite
I have been trying to learn assembly for a few years now. I get
Im trying to learn a bit about c++ and have run in to some
I've been trying to learn 32-bit Intel x86 nasm syntax assembly on my Linux
So I'm trying to learn some x86 assembly, I'm using NASM as my complier.
I am trying to learn assembly language. I have searched and found how to
I've been trying to learn embedded software development for some time (been doing software
Trying to learn about php's arrays today. I have a set of arrays like
Trying to learn MVP pattern with C#... Does anyone know of any particularly good
I've been trying to learn about metaclasses in Python. I get the main idea,

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.