Date: Sun, 16 Oct 2011 23:07:59 +0100 From: Matthew Seaman <m.seaman@infracaninophile.co.uk> To: freebsd-questions@freebsd.org Subject: Re: need to check for hex in C: how/ Message-ID: <4E9B55BF.3090305@infracaninophile.co.uk> In-Reply-To: <20111016212628.GA30284@thought.org> References: <20111016212628.GA30284@thought.org>
next in thread | previous in thread | raw e-mail | index | archive | help
This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigFF2D72D1017D47DCEDBA86E3 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On 16/10/2011 22:26, Gary Kline wrote: > if n =3D=3D 15 and x is the int. i can say=20 >=20 > if ((int)x =3D=3D 15) Or to check if x =3D=3D 'A' i can cast x to (cha= r)x. >=20 > what's the syntax to chec if x is , say, 32/ In C code you can write an integer constant in hexadecimal by prefixing it with 0x -- so 0x32 is the hexadecimal constant equal to decimal 50. if ( x =3D=3D 0x32 ) ... I guess that's what you're asking; '32/' is not any sort of syntax I've ever seen before to indicate hexadecimal. Cheers, Matthew Tempted to interpret it as 32 shillings old money (=A31.60 in decimal coi= nage) --=20 Dr Matthew J Seaman MA, D.Phil. 7 Priory Courtyard Flat 3 PGP: http://www.infracaninophile.co.uk/pgpkey Ramsgate JID: matthew@infracaninophile.co.uk Kent, CT11 9PW --------------enigFF2D72D1017D47DCEDBA86E3 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.16 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk6bVcYACgkQ8Mjk52CukIzPjgCfbbN/5V6VeQzB5tNTv/au9obn Dm8AoJV52+YBYtvWQfLK0QzhuPKHGl29 =tlsK -----END PGP SIGNATURE----- --------------enigFF2D72D1017D47DCEDBA86E3--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4E9B55BF.3090305>