linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Adam Kropelin" <akropel1@rochester.rr.com>
To: linux-c-programming@vger.kernel.org
Subject: Re: using 'int char' with #define's variables.
Date: Sun, 1 Sep 2002 18:28:04 -0400	[thread overview]
Message-ID: <0b8901c25206$d71b09b0$02c8a8c0@kroptech.com> (raw)
In-Reply-To: 20020901153529.A16903@namodn.com

----- Original Message -----
From: "Nick Jennings" <nkj@namodn.com>
To: <linux-c-programming@vger.kernel.org>
Sent: Sunday, September 01, 2002 6:35 PM
Subject: using 'int char' with #define's variables.


> Hi All,
>
>   A function that has a prototype of:
>
> char * strrchr( char * str, int ch );
>
>   It takes a character as an int in that second param.
>
>   I am having trouble using it with a #define's VAR.
>
> ---
> #define DIRMARK "/"

That's a string (i.e., a char*), not a char.
Double quotes give you a string, single quotes give you a char.

/* This is a pointer to a null-terminated string of characters */
#define DIRMARK "/"

/* This is a single char */
#define DIRMARK '/'

> gcc complains:
> warning: passing arg 2 of `strrchr' makes integer from pointer without a cast

...which is exactly what's happening. You're passing a char* where it expects an
int.

--Adam



  reply	other threads:[~2002-09-01 22:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-09-01 22:35 using 'int char' with #define's variables Nick Jennings
2002-09-01 22:28 ` Adam Kropelin [this message]
2002-09-02  1:16 ` Stephen Satchell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='0b8901c25206$d71b09b0$02c8a8c0@kroptech.com' \
    --to=akropel1@rochester.rr.com \
    --cc=linux-c-programming@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).