Question: How to printf the semicolon ";"?

Discussion in 'C Programming' started by Ken, Dec 26, 2006.

  1. Ken

    Ken Guest

    Hi all,

    I want to printf a sentence with a semicolon, for examples:
    printf(" I like C language; You like C++ language.");
    But C compiler alway identify the semicolon as a end of a sentence and
    presents an error.

    My question is:

    How to printf the semicolon ";" in C language?

    Sincerely,

    Ken
     
    Ken, Dec 26, 2006
    #1
    1. Advertising

  2. In article <>,
    Ken <> wrote:
    >
    >I want to printf a sentence with a semicolon, for examples:
    > printf(" I like C language; You like C++ language.");
    >But C compiler alway identify the semicolon as a end of a sentence and
    >presents an error.


    You don't need to do anything special to print a semicolon. Well,
    perhaps you need to find a better C compiler. Can you give us a
    complete program that won't compile, and the name of the compiler so
    that we can avoid it, please.

    -- Richard
    --
    "Consideration shall be given to the need for as many as 32 characters
    in some alphabets" - X3.4, 1963.
     
    Richard Tobin, Dec 26, 2006
    #2
    1. Advertising

  3. Ken

    Random832 Guest

    2006-12-26 <>,
    Ken wrote:
    > Hi all,
    >
    > I want to printf a sentence with a semicolon, for examples:
    > printf(" I like C language; You like C++ language.");
    > But C compiler alway identify the semicolon as a end of a sentence and
    > presents an error.


    Your C compiler is wrong, or that is not the code you tried to compile.

    >
    > My question is:
    >
    > How to printf the semicolon ";" in C language?
    >
    > Sincerely,
    >
    > Ken
    >
    >
     
    Random832, Dec 26, 2006
    #3
  4. Random832 <> writes:
    > 2006-12-26 <>,
    > Ken wrote:
    >> I want to printf a sentence with a semicolon, for examples:
    >> printf(" I like C language; You like C++ language.");
    >> But C compiler alway identify the semicolon as a end of a sentence and
    >> presents an error.

    >
    > Your C compiler is wrong, or that is not the code you tried to compile.


    If I were sufficiently interested, I'd be willing to bet a fairly
    large amount of money that his compiler is not at fault.

    Ken: You print a semicolon the same way you print, say, an 'X'. The
    printf call you showed us looks perfectly correct (except that you
    probably want a \n at the end of the line).

    Write a small complete program that includes the above statement. If
    it prints the semicolon, you're done. If it fails, post your code
    (the *exact* code: copy-and-paste it, do *not* re-type it) and tell us
    exactly how it fails (again, copy-and-paste any error message).

    --
    Keith Thompson (The_Other_Keith) <http://www.ghoti.net/~kst>
    San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
    We must do something. This is something. Therefore, we must do this.
     
    Keith Thompson, Dec 26, 2006
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. ben
    Replies:
    4
    Views:
    624
    Martin Ambuhl
    Jun 26, 2004
  2. whatluo

    (void) printf vs printf

    whatluo, May 26, 2005, in forum: C Programming
    Replies:
    29
    Views:
    1,252
  3. azza

    printf affects following printf/s

    azza, Oct 17, 2010, in forum: C Programming
    Replies:
    0
    Views:
    434
  4. guru
    Replies:
    8
    Views:
    285
  5. Peter Michaux

    Cookies: semicolon vs. semicolon-space

    Peter Michaux, Dec 10, 2006, in forum: Javascript
    Replies:
    3
    Views:
    221
    Michael Winter
    Dec 11, 2006
Loading...

Share This Page