How to use printf() return value in C

1 Answer

0 votes
#include <stdio.h>

int main() {
    int result = printf("C Programming");
    
    printf("\nThe total printed characters are: %d\n", result);
    
    if (result == 13) {
        printf("OK\n");
    }
}



/*
run:

C Programming
The total printed characters are: 13
OK

*/

 



answered Jun 6, 2023 by avibootz

Related questions

1 answer 155 views
155 views asked Apr 25, 2022 by avibootz
1 answer 142 views
142 views asked Jun 6, 2023 by avibootz
1 answer 114 views
1 answer 136 views
136 views asked Dec 19, 2023 by avibootz
2 answers 176 views
...