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...
Shornick asked 7/4, 2014 at 4:5

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...
Montevideo asked 23/5, 2012 at 13:21

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...
Hercule asked 9/7, 2013 at 15:39

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...
Mortise asked 22/1, 2009 at 6:59

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...
Interstitial asked 17/2, 2019 at 4:38

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...
Cerelly asked 20/5, 2014 at 1:48

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...
Futurism asked 28/11, 2014 at 7:29

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...
Argumentative asked 24/5, 2014 at 11:22

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) ...
Twi asked 21/1, 2014 at 10:10

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...
Issiah asked 3/7, 2013 at 16:4

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 a = getchar() equivalent to scanf("%c",&a);? Is putchar(a) equivalent to printf("%c",a); where a is a char variable?
Bacciferous asked 20/3, 2010 at 10:26
1

© 2022 - 2024 — McMap. All rights reserved.