Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Buy a domain name - Register cheap domain names from $0.99 - Namecheap

Scalable Hosting That Grows With You

Secure & Reliable Web Hosting, Free Domain, Free SSL, 1-Click WordPress Install, Expert 24/7 Support

Semrush - keyword research tool

Boost your online presence with premium web hosting and servers

Disclosure: My content contains affiliate links.

39,990 questions

51,935 answers

573 users

How to use putc to output characters to stdout in C

1 Answer

0 votes
#include <stdio.h>
#include <stdlib.h>

int main(void)
{
    int result = 0;
    for (char ch = 'a'; (result != EOF) && (ch != 'z'); ch++)
        result = putc(ch, stdout);

    if (result == EOF) {
        if (ferror(stdout)) {
            puts("putc() error");
            exit(EXIT_FAILURE);
        }
    }

    return 0;
}




/*
run:

abcdefghijklmnopqrstuvwxy

*/

 



answered Feb 4, 2023 by avibootz

Related questions

1 answer 121 views
2 answers 180 views
180 views asked Jan 25, 2016 by avibootz
1 answer 172 views
1 answer 217 views
...