Thread: char function call

  1. #16
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,665
    > and i would like to know one more thing.is there any difference between char* a and char *a?
    Semantically, no.

    But from a style point of view,
    Code:
    char  *a, b;
    char*  c, d;
    you have a better chance working out that b is a character, than you have of working out that d is a character.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  2. #17
    Registered User
    Join Date
    Feb 2013
    Posts
    6
    in the first case only a will be a pointer and in the second case both c and d will be a pointer.that's what it means.So there is no difference in its usage.only difference is while we declare.am i right?

  3. #18
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,665
    > in the first case only a will be a pointer and in the second case both c and d will be a pointer.that's what it means.
    Like I said, easier to figure out.
    By the way, you're wrong.

    a and c a pointers to char
    b and d are just chars.

    The position of the * is irrelevant.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  4. #19
    Registered User
    Join Date
    Feb 2013
    Posts
    6
    ok.i got it now.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 3
    Last Post: 09-22-2011, 09:59 PM
  2. Replies: 8
    Last Post: 07-08-2011, 01:16 PM
  3. Second scanf call with char does not work
    By madwizzy in forum C Programming
    Replies: 2
    Last Post: 02-15-2011, 10:37 PM
  4. Replies: 5
    Last Post: 10-17-2006, 08:54 AM
  5. Call by (char) or (string)?
    By Blackroot in forum C++ Programming
    Replies: 11
    Last Post: 01-04-2006, 07:51 PM