[Tutorial] Strcmp explained/how does it work exactly.
#7

Quote:
Originally Posted by Hiddos
Посмотреть сообщение
I did see why it returned 0 on success, but I was wondering why it could either return -1 or 1. Could you explain that as well?
Yes, ASCII-Codes are like numbers, every character has a number. If you compare a character that has a lower ASCII value then the one you're comparing it to has (for example: 5 - 7 = -2), it will return a negative result. Same applies for whole strings. I think PAWN just rounds any values under 0 to -1 and any values above it to 1.

Quote:

At first I thought this was another strcmp/strtok command tutorial, but I'm glad it isn't. I actually never knew how strcmp actually works, just that it works. I learnt something new today.

Thank you, glad I could help
Reply


Messages In This Thread
Strcmp explained/how does it work internally. - by Sinner - 23.04.2011, 11:11
Re: Strcmp explained/how does it work exactly. - by Vince - 23.04.2011, 11:39
Re: Strcmp explained/how does it work exactly. - by Ash. - 23.04.2011, 11:42
Re: Strcmp explained/how does it work exactly. - by Hiddos - 23.04.2011, 11:54
Re: Strcmp explained/how does it work exactly. - by Ash. - 23.04.2011, 11:58
Re: Strcmp explained/how does it work exactly. - by Davz*|*Criss - 23.04.2011, 12:01
Re: Strcmp explained/how does it work exactly. - by Sinner - 23.04.2011, 15:37
Re: Strcmp explained/how does it work exactly. - by Hiddos - 23.04.2011, 17:34
Re: Strcmp explained/how does it work exactly. - by Tee - 29.04.2011, 21:24
Re: Strcmp explained/how does it work exactly. - by LiamM - 29.04.2011, 21:33
Re: Strcmp explained/how does it work exactly. - by SchurmanCQC - 29.04.2011, 21:39
Re: Strcmp explained/how does it work exactly. - by Sinner - 30.04.2011, 16:21
Re: Strcmp explained/how does it work exactly. - by Aoi_Rikuto - 02.06.2011, 10:23
Re: Strcmp explained/how does it work exactly. - by MdeRooy - 19.07.2011, 19:01
Re: Strcmp explained/how does it work exactly. - by Jack_Rocker - 20.07.2011, 09:20
Re: Strcmp explained/how does it work exactly. - by iggy1 - 20.07.2011, 11:37
Re: Strcmp explained/how does it work exactly. - by Astralis - 19.11.2011, 09:23
Re: Strcmp explained/how does it work exactly. - by CSSI - 19.11.2011, 13:24
Re: Strcmp explained/how does it work exactly. - by JaKe Elite - 21.08.2012, 11:55
Re: Strcmp explained/how does it work exactly. - by ddnbb - 22.08.2012, 22:07
Re: Strcmp explained/how does it work exactly. - by NoahF - 27.09.2012, 19:16
Re: Strcmp explained/how does it work exactly. - by Zempist - 28.02.2013, 02:19
Re: Strcmp explained/how does it work exactly. - by mastermax7777 - 28.02.2013, 03:53
Re: Strcmp explained/how does it work exactly. - by ¤Adas¤ - 02.03.2013, 09:56
Re: Strcmp explained/how does it work exactly. - by TheRaGeLord - 17.07.2015, 05:19

Forum Jump:


Users browsing this thread: 2 Guest(s)