Address issue of matrices in C [closed]

A matrix X [-15 . . . 10, 15 . . . 40] is given.Each memory address holds 1 byte of memoryFind the address of X[10][40].

Note: The notation of the matrix is rather orthodox and confusing. It says that these are the indices of the matrix. I have come across comments that this does not look like a matrix. But I came across this and I can assure hundreds of other people also do, so it will be helpful to clear this for once and for all. The simple question here is if the X[10][40] will be accessible or not as from the indices we get that there are 26 rows and 26 columns. The calculation for the number of rows in done below. My confusion is if said in one line is that as there are 26 rows and 26 columns, then [1][26] will occupy one byte of memory.In the lieu of that will [1][27] also hold 1 byte of memory. Because I haven’t declared it to have 1 byte of memory. And following this will [10][40] also hold 1 byte of memory.I hope my question is now clear. However, if any doubt is still there,I would be more than happy to address it.:).

Lr = Lower limit of row/start row index of a matrix, if not given assume 0 (zero)

Lc = Lower limit of column/start column index of a matrix, if not given assume 0 (zero)

If the beginning location is 1500 determine the location of X[10][40] for both row-major and column-major order.

Every element of the matrix requires 1 byte of storage.

The question is solved by this ugly looking formula.

Number or rows say M = (Ur – Lr) + 1

Number or columns say N = (Uc – Lc) + 1

Row Major Wise Calculation:

Address of A [ I ][ J ] = B + W * [ N * ( I – Lr ) + ( J – Lc ) ]

Column Major Wise Calculation :

Address of A [ I ][ J ] = B + W * [ ( I – Lr ) + M * ( J – Lc ) ]

B = Base address

I = Row subscript of the element whose address is to be found

J = Column subscript of the element whose address is to be found

W = Storage Size of one element stored in the array (in byte)

Lr = Lower limit of row/start row index of a matrix, if not given assume 0 (zero)

Lc = Lower limit of column/start column index of a matrix, if not given assume 0 (zero)

M = Number of rows of the given matrix

N = Number of columns of the given matrix

The question is [10][40] valid or out of bounds here.Can we calculate its address?

Here i proceeded like this:

For X[10][40]:

Row-major:1500+1* [26 * (10 – (-15))) + (40 – 15)]=2175

Column-major:1500 + 1 * [(10– (-15)) + 26 * (40 – 15)]=2175

How to ban IP address behind NAT

I am creating WebSocket server with rust and tokio and I want to prevent DDos attacks and spams.

So I thought of creating HashMap and inserting IP address which i suspect are trying to do spamming or DDos Attack but will this also ban other innocent users sharing same NAT network with attacker ?

If I ban IP address and port combination, will the attacker just use other port?

How to mask a geographic IP address on corporate VPN [duplicate]

My wife is working remote due to COVID for a company that has a policy in place to not work from outside of California for an extended period of time. She logs in via a corporate VPN using our home WiFi network.

We are moving from LA to Phoenix had she would like to hang on to her job until COVID is over.

Are there any options to mask the IP address of our Phoenix ISP? I have read that one solution is the use of a VPN, but her company is already using one for her to log into her corporate environment. She has no admin access to her laptop.

How Can I Deflect The Scanned IP Address to The Honeypots?

I never use honeypot before. But, I have a task from my lecture, that I should use a honeypot for detecting hackers attacks.

I searched in journals, tutorials and articles. I tried using honeydrive3 and used the honeypot Kippo. When I tried that, and I attack by myself, it works, the detailed of attack is served. But, when I told that to my lecturer, he said it was not what he wanted.

The workflow he want is, we use the honeypot and then we try that to some websites. But, when the attacker scanning or do something to that web IP address, it must deflect to the honeypot, it means that the attacker really attacks the real website.. and I really don’t know what to do.

How do you get a secure bastion host if your IP address is constantly changing?

I am setting up AWS stuff and wondering how to setup a secure bastion host. They all say to only allow access to your IP address, but how can I do that if my IP address is changing every few hours or days (just in my house wifi, or going to coffee shops, etc.). What is best practice here, for SSHing into a bastion host and limiting access somehow to only specific IP addresses. If not possible, what is the next best alternative?

How do I stop an Image Address from loading in the Browser?

Ultimately, I want to be able to disable the Right Click option across a website I am working on. I have managed to disable this across the Blog Content and all of the Images that appear within the Blog.

I have noticed that when you enter the Image address directly into the Browser, the Right Click still works. I have tried modifying the Code Snippets I have, as well as various Plugins, but nothing seems to work. Would it be a case that it is not possible to disable the Right Click option when loading the original image, by entering its Image address into the Browser?

Assuming this is the case, is it possible to prevent the Image from loading when entering the Image Address directly within the browser?

If there is a way, would this prevent the image from loading in Blog Posts etc too?