LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Simple question about putchar ... in C (https://www.linuxquestions.org/questions/programming-9/simple-question-about-putchar-in-c-24639/)

purpleburple 06-29-2002 11:25 PM

Simple question about putchar ... in C
 
Is this the only way to have a newline after a putchar?

#include <stdio.h>

int main(void)
{

char letter = 'Y';

putchar(letter);
printf("\n");

return 0;

}


thanks
New C programmer :)

Config 06-30-2002 04:58 AM

You could also use putchar('\n').
'\n' is one character, so you could also declare: char letter = '\n'


All times are GMT -5. The time now is 07:04 AM.