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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T21:25:24+00:00 2026-05-28T21:25:24+00:00

I have a project in C and I have to scan an array[10][15] diagonally

  • 0

I have a project in C and I have to scan an array[10][15] diagonally as in the picture below.

enter image description here

I would like to help me to find how to scan the array this way…
Thank you very much.

P.S sorry for my english(I’m Greek)

  • 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-28T21:25:24+00:00Added an answer on May 28, 2026 at 9:25 pm

    Notice that along each diagonal, the difference* i - j is constant. So you have a nested double loop, where the outer one goes over the difference:

    • First round: Difference -14, arr[0][14]

    • Second round: Difference -13, arr[0][13], arr[1][14]

    • …

    • last round: Difference +9, arr[9][0].

    In code:

    for (int d = -14; d < 10; ++d)
    {
        for (int i = 0; i < d + 15 && i < 10; ++i)
        {
          if (i < d) continue;
    
          // access arr[i][i - d];
          printf("[%d, %d]\n", i, i - d);
        }
    }
    

    Note the appearance of the numbers 10 and 15 in the code; the picture is readily generalized to arbitrary array bounds.

    *) Or, as @Alexey points out, the sum i + j is constant, depending on where the origin is in your picture; in that case, modify the loop as follows:

    for (int d = 0; d <= 9 + 14; ++d)
    {
        for (int i = 0; i <= d && i < 10; ++i)
        {
            if (i + 15 <= d) continue;
            // use arr[i][d - i];
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My situation is: I have a project that scan a directory of libs. This
I am very desperate now... I have project in Visual C++ 2010 using Qt
Would like to see if someone can help me on figuring out how to
I used this project to simulate the bluetooth on android emulator. I have 2
I have a java project which is previously developed by another developer, in this
I have the zxing library imported into my project and the scanner works like
I have recreated this project in Eclipse as many ways as I can think
The AjaxMin project at http://ajaxmin.codeplex.com/ is great and very useful. What I have previously
Right now in our project, we have below mentioned structure. Our project is mainly
I am doing a project to scan qr codes.a. In this project a history

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.