Example char c c putchar cSyntax putchar variable name LPU CSE101 C Programming

Example char c c putchar csyntax putchar variable

This preview shows page 6 - 12 out of 15 pages.

Example: char c= ‘c’; putchar (c); Syntax putchar ( variable name);
Image of page 6
©LPU CSE101 C Programming #include<stdio.h> void main() { char ch; printf(“enter a character: ”); scanf(“%c”, ch); putchar(ch); } enter a character: r r
Image of page 7
©LPU CSE101 C Programming getch() & getche() These functions read any alphanumeric character from the standard input device The character entered is not displayed by the getch() function until enter is pressed The getche() accepts and displays the character. The getch() accepts but does not display the character. Syntax getche(); Quick yak: Usually getch() is used to wait for a key press from the user “Press any key…” Is acquired by getch
Image of page 8
©LPU CSE101 C Programming #include<stdio.h> void main() { printf(“Enter two alphabets:”); getche(); getch(); } Enter two alphabets a
Image of page 9
©LPU CSE101 C Programming putch() This function prints any alphanumeric character taken by the standard input device Example: #include<stdio.h> void main() { char ch; printf(“Press any key to continue”); ch = getch(); printf(“ you pressed:”); putch(ch); } Press any key to continue You pressed : e
Image of page 10
©LPU CSE101 C Programming gets() String I/O
Image of page 11
Image of page 12

You've reached the end of your free preview.

Want to read all 15 pages?

  • Spring '18
  • Aman
  • Input device, Input/output, char c

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern

Stuck? We have tutors online 24/7 who can help you get unstuck.
A+ icon
Ask Expert Tutors You can ask You can ask You can ask (will expire )
Answers in as fast as 15 minutes
A+ icon
Ask Expert Tutors