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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T08:37:48+00:00 2026-05-11T08:37:48+00:00

Given an array of 81 elements (meant to represent a 9×9 grid) how can

  • 0

Given an array of 81 elements (meant to represent a 9×9 grid) how can I go over each element, grabbing the three around it and then performing an operation on those, then continuing to the next three of each row, column, or submatrix. Look below or at a sudoku grid to see the layout.

 define COL(n)      ((n) % 9) define ROW(n)      ((n) / 9) define SUB(n)      ((n / 3) % 9) 

For example, I have

 int grid[81]; 

and

 int array_x[9], array_y[9], array_s[9]; 

Since the total 9x9 grid can be split into 9 of the following categories, there are nine elements in each array, and I hope to take the elements of each column (the x axis) in groups of threes, perform

 r = ((a = ~a) & (b = ~b)) | ((b | a) & ~c);  // or  r = ((~a & ~b)) | ((~b | ~a) & ~c); 

on them, take the three resultant numbers, and perform it on them, and then store it into the array.

If this sounds impossible, sorry, I'd like a different way to do this. Definitely open to suggestions...

  • 1 1 Answer
  • 4 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. 2026-05-11T08:37:49+00:00Added an answer on May 11, 2026 at 8:37 am

    Another try:

    void applyThingy(int *grid, int xPitch, int yPitch) {     int row, column;     int *rowPointer = grid;      for(row = 0; row < 3; ++row)     {         int *columnPointer = rowPointer;          for(column = 0; column < 3; ++column)         {             doOperation(columnPointer);             columnPointer += xPitch;         }          rowPointer += yPitch * 9;     } }  applyThingy(&grid[SUB(n)], 1, 1); // Perform on 3x3 subgrid applyThingy(&grid[ROW(n)], 1, 0); // Perform on row applyThingy(&grid[COL(n)], 0, 1); // Perform on column 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How to count array elements after the first occurrence of a given element? For
Given an array of integers, what is the simplest way to iterate over it
Given an array like {one two, three four five}, how'd you calculate the total
Given an array of items, each of which has a value and cost ,
Given following Ruby statements: (Read input and store each word in array removing spaces
Given an array with N elements. We know that one of those elements repeats
Suppose that you're given an array A of n distinct elements drawn from some
Given you have an array A[1..n] of size n, it contains elements from the
I want to divide the elements of my array for the first element of
I have a string. I need to replace all instances of a given array

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.