From owner-freebsd-questions@FreeBSD.ORG Sun Oct 16 21:58:06 2011 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1D0DD106564A for ; Sun, 16 Oct 2011 21:58:06 +0000 (UTC) (envelope-from freebsd@edvax.de) Received: from mx01.qsc.de (mx01.qsc.de [213.148.129.14]) by mx1.freebsd.org (Postfix) with ESMTP id D532C8FC13 for ; Sun, 16 Oct 2011 21:58:05 +0000 (UTC) Received: from r56.edvax.de (port-92-195-40-141.dynamic.qsc.de [92.195.40.141]) by mx01.qsc.de (Postfix) with ESMTP id 1BB5E3F6A3; Sun, 16 Oct 2011 23:58:04 +0200 (CEST) Received: from r56.edvax.de (localhost [127.0.0.1]) by r56.edvax.de (8.14.5/8.14.5) with SMTP id p9GLw3NT003221; Sun, 16 Oct 2011 23:58:03 +0200 (CEST) (envelope-from freebsd@edvax.de) Date: Sun, 16 Oct 2011 23:58:03 +0200 From: Polytropon To: Gary Kline Message-Id: <20111016235803.40b2181a.freebsd@edvax.de> In-Reply-To: <20111016212628.GA30284@thought.org> References: <20111016212628.GA30284@thought.org> Organization: EDVAX X-Mailer: Sylpheed 3.1.1 (GTK+ 2.24.5; i386-portbld-freebsd8.2) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: FreeBSD Mailing List Subject: Re: need to check for hex in C: how/ X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Polytropon List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Oct 2011 21:58:06 -0000 On Sun, 16 Oct 2011 14:26:31 -0700, Gary Kline wrote: > > if n == 15 and x is the int. i can say > > if ((int)x == 15) Or to check if x == 'A' i can cast x to (char)x. > > what's the syntax to chec if x is , say, 32/ The integer types are automatically casted, no matter if you compare (int) or (char) to a numerical or character value. int i; char c; if(i == 32 || i == ' ') ... if(c == 32 || c == ' ') ... Functions or macros that deal with characters usually do return (int), even though one would expect (char). -- Polytropon Magdeburg, Germany Happy FreeBSD user since 4.0 Andra moi ennepe, Mousa, ...