putchar Questions
9
Solved
I've been working on this for 2 hours and I am stuck... I found the answer online, but that isn't going to help me learn the concept that I'm obviously missing.
Prompt: Write a program to copy its...
9
Solved
I'm reading The C Programming Language and have understood everything so far.
However when I came across the getchar() and putchar(), I failed to understand what is their use, and more specifically...
9
Solved
I'm reading K&R's The C Programming Language and have become confused on putchar and getchar. I made a program where you enter 10 chars and the program prints them back out to the screen.
#inc...
Brookes asked 14/10, 2013 at 19:26
3
Solved
I'm working through "The C Programming Language" by K&R and example 1.5 has stumped me:
#include <stdio.h>
/* copy input to output; 1st version */
int main(int argc, char *argv[])
{
in...
4
Solved
If for example I should not use standard library functions like printf(), putchar() then how can I print a character to the screen?
Is there an easy way of doing it. I dont know much about system c...
2
Solved
So I want to print the copyright symbol and putchar() just cuts off the the most significant byte of the character which results in an unprintable character.
I am using Ubuntu MATE and the encodin...
5
Solved
I am currently in chapter 1.5.1 File copying and made a program like so:
#include <stdio.h>
/* copy input to output; 1st version */
main()
{
int c;
c = getchar();
while (c != EOF) {
pu...
4
Solved
If I type the words "Hello World" into the standard input stream, this program will print out weird box symbols instead of the expected "Hello World" back into standard output.
#include <stdio....
Zoila asked 27/3, 2015 at 7:12
1
Solved
I am running the following program from the C Programming Language book:
#include <stdio.h>
main()
{
int c;
while((c=getchar()) != EOF)
putchar();
}
Or
#include<stdio.h>
int mai...
3
Solved
In Kernighan and Ritchie (the C programming language):
'Write a program to print the value of EOF'
I wrote:
#include <stdio.h>
main(){
int c;
c = getchar();
if ((c = getchar()) == EOF...
4
Solved
I am trying to understand how the putchar('0' + r); works. Below, the function takes an integer and transform it to binary.
void to_binary(unsigned long n)
{
int r;
r = n % 2;
if (n >= 2)
...
3
Solved
In C, strings are arrays of char (char *) and characters are usually stored in char. I noticed that some functions from the libC are taking as argument integers instead of a char.
For instance, le...
4
Solved
in the example:
#include <stdio.h>
main()
{
long nc;
nc = 0;
while (getchar() != EOF)
++nc;
printf("%ld\n", nc);
}
I don't quite understand it. putchar() would put the character out...
Teshatesla asked 2/2, 2010 at 23:46
2
Solved
Is getchar() equivalent to scanf("%c") and putchar() equivalent to printf("%c")?
Is a = getchar() equivalent to scanf("%c",&a);?
Is putchar(a) equivalent to printf("%c",a); where a is a char variable?
1
© 2022 - 2024 — McMap. All rights reserved.