Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4

Thread: putchar

  1. #1
    New Coder
    Join Date
    Jul 2002
    Location
    Malaysia
    Posts
    61
    Thanks
    0
    Thanked 0 Times in 0 Posts

    putchar

    Dear sir,

    How to use the "putchar" in the string. Can you give me an example and define it.

    Thanks

    Xiang

  2. #2
    Regular Coder
    Join Date
    Feb 2003
    Location
    East Side/West Side
    Posts
    118
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Syntax:
    #include <stdio.h>
    int putchar(int c);

    c is the numeric value of a character (65 is 'A' for example). It prints out the character by the numeric value.

    #include <stdio.h>
    main() {
    putchar(65);
    putchar(66);
    }

    Would output

    A
    B

  3. #3
    New Coder
    Join Date
    Jun 2002
    Posts
    66
    Thanks
    0
    Thanked 0 Times in 0 Posts
    or you could just say putchar('A'); putchar('B'); to make it easier.

  4. #4
    Regular Coder
    Join Date
    Feb 2003
    Location
    East Side/West Side
    Posts
    118
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Pretty much, but the numbers make you look smarter (and, of course, geekier )


 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •