Why is this happening in my basic password program?

why is this happening in my basic password program?

>inb4 doing my homework I'm a dropout trying to teach myself code

well, the first line is wrong because array comparison always evaluates to true in you shitty ass compiler

how do i fix it? is the problem only in xcode?

Your two strings are no the same size, string pass word is of 10 bits (char = 1bit) and login is of 100 bits. You can check this by using the sizeof() function.

You need to write a function to check each letter individual that terminates at either '\n' or '\0'. I'd personally just take the ascii code value for each letter and compare the totals. There are many ways to do this depending on what library you use but I'd say math.h is the go

don't compare arrays, it's undefined behavior. you don't seem to understand very well what arrays are, suffice to say that

login != password

doesn't nearly do what you think it does

thank you. please tell me how to fix the problem now

you're adding the letters and comparing the totals? why the fuck would you do that?

also the size has absolutely nothing to do with the problem, and math.h is a library for, surprise, math functions, why have absolutely nothing to do here either.

what the fuck are you even doing?

How about you do your homework user. No tech start up is going to hire you anyways.

Type 'how to compare strings' into a search engine.

make a for loop that takes respective char and compares it to it's counterpart in password. Use an if() statement to determine pass/fail

ie:
if( password[n] != login[n] ) {
printf("password incorrect\n");
return NULL;
}

I have a library of molecules with values in a multi column array, I guess it's just a habit. My c++ version also wont let me do addition without math.h (I'll upgrade to visual studio one day)

I thought Veeky Forums was full of CS majors.

You are comparing the addresses of the two arrays. Use strcmp(login, password).

summing is a REALLY BAD hash. it's not a habit, just something you thought up quickly like last week or some shit

if you can't add without math.h then you're doing something really wrong. visual studio isn't "an upgrade" and you don't need "an upgrade" to use basic core language.

really what the fuck are you doing?

so how would that finalized code look like?

I'll have to find a new way to do it then when i search for stuff.

What am I doing? Well what I did was make a database to contain all the info from my SI chem data book that I can carry round on a USB rather than paying for a program.

so how would I search for say molecule x? with parameters w x y z? Should I even use an array for that?

I tried some other methods but had a problem getting all the data to other functions. I think I had some address issue there though

you are using char for a string

Don't you know what a function is?

>Antonio420

while(strcmp(login,password))

>passwords stored instead of salted and hashed
AAAAAAAAAAAAAAHHHHHHHHHHHHHHHH

delete c:\windows\system32

just speculating
password is 10 elements
login is 100, regardless of what's entered by the user
they're inherently different

if you wanna do it that way write a loop that compares elements at corresponding indicies in both arrays up to the index length-1 of array login.

Please never store passwords in plain text. Salt them and hash them, you abusive monkey nobber

because arrays are only pointers and you're comparing pointers.

since password and login cannot be on the same address, the comparison will always return true.

Why do people teach themselves code?

It's like teaching yourself Photoshop. Neither fun or can be considered as a hobby. No job prospects / income. What the fuck is the point other than to be able to tell others 'omg im such a nerdy code monkey xdddd im so smart lol'

Do you want an answer, or are you just baiting ?

you have a buffer overflow vulnerability there

>>inb4 doing my homework I'm a dropout trying to teach myself code

>trying to teach myself code

then you need to stop teaching yourself to code in the C programming language, that way lies headaches you don't need.

I am almost certain I can recommend a better language for you - what do you need to do with your code?

He has lots of shit in there - first and foremost a decision to code in C which is terrible on like five different levels unless he specifically needs C.

Get a proper C book

I recommend C: A Modern Approach by King

Jesus no.

OK I am ragging on C because C is terrible - I should know, C is my day job.

C has exactly three purposes:

>I need to understand old code that was written in C

>I need to code for a platform that only supports C

>I need to interface with code that was written in C

For ALL OTHER PURPOSES, there exists a better language.

I taught myself to code in C and it surely was a good choice because I was then able to learn a lot about systems and pick up a lot of other programming languages very quickly

shut the fuck up you autist. Don't drag others down because of your self loathing

>shut the fuck up you autist. Don't drag others down because of your self loathing

What's self loathing got to do with it? I got my job exactly because I am a straight baller at hardware-level programming.

That's NOT WHAT OP IS DOING so maybe he should stop listening to your terrible advice and start listening to mine instead.

k but
I think we can all agree java is aids

No you fucking autist. It's not like a fucking animu or pokemon where there's good characters and bad ones... Why don't you kill yourself instead of polluting the internet

>I think we can all agree java is aids

There's a lot of shit software programmed in Java. I'm not familiar enough with the language to comment beyond that.

>Ruby
>Not Node (javascript)

Get with the times, grandpa.

This. I'm surprised it took so long for someone to point this out.