#2d array in c language

1 messages · Page 1 of 1 (latest)

spiral jungle
#

i didnt get the 2 loops here its just swapping rows and colums but im having hard times understanding the loops and especially second one for(j=0;j<i;j++)

spiral jungle
#

so i can understand

thick field
#

They're doing nothing

spiral jungle
#

💀

thick field
#

They're probably ignored by the compiler

spiral jungle
spiral jungle
thick field
#

J is initialized into the for loop scope

#

It isn't used inside it

#

It just doesn't do anything

#

Oh no

#

You right

#

Lmao

spiral jungle
#

YEAH

#

its just matrix

#

but not an equal dimensional one

thick field
#

What is hard to understand for u?

spiral jungle
#

but still works as a one

spiral jungle
thick field
#

Anyway , they're idiot

spiral jungle
#

who

thick field
#

Because the could just do j = B

#

Instead of the for loop

spiral jungle
#

hm can u write it down wdym

thick field
#

lmao

#

It's the same thing

spiral jungle
#

like

#

the matrix isnt equal

thick field
spiral jungle
#

rows and columns

thick field
#

Just reason

#

I have to study history for the tomorrow test

#

I'll explain you tomorrow

#

Basically they for loop make j equal to B

#

They can just replace it with j = B

#

Same for all the other for loops

spiral jungle
thick field
#

Did you read my messages,

#

Anyway

#

I don't know math so...

#

Yeah

spiral jungle
#

i did but i thought

thick field
#

I can't help you

spiral jungle
#

okay its okay

thick field
spiral jungle
#

other than thatttt

#

im literally first 4 months of learning coding

#

and iour uni decided to start with c

thick field
#

There's no ;

#

So the loop includes the loop below

#

And it makes sense

#

@spiral jungle

#

I was wrong , sorry

#

Anyway, scanf isn't a great idea

#

Buffer overflow is dangerous

#

Use fgets instead of scanf

#

Remember to convert it to int

#

First cast and then subtract

#

Oh wait

#

Nah

#

It's a bad idea

#

Just use scanf , screw security

#

I have a doubt

#

If you're using the same array

#

Deosn't it overwrite the other numbers?

obtuse fjord
#

it iterates through this part [\ of the matrix and switch it with ]

thick field
#

I'm trash

#

I can't even help