Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

closed how to print any text without using printf statement

+13 votes
asked Jan 10 by Aniket Matkar (210 points)
closed Feb 21 by Admin
closed with the note: answered

5 Answers

+3 votes
answered Jan 11 by Peter Minarik (55,660 points)

I assume we're talking about C language only, (C++ functions, such as std::cout << are not included)

I'm not sure why you don't want to use the printf() or its variants (e.g. fprintf()) that suit the majority of the cases, but if you really don't want to use it, you can check out puts() or putc() to put a whole string or a single character on the standard output respectively. You find them in stdio.h.

0 votes
answered Jan 11 by Kanchan Singh (140 points)
we can use puts() function to print any text.
0 votes
answered Jan 19 by Rachad Chazbek (140 points)

Use the write system call:

#include <fcntl.h>
size_t write (int fd, void* buf, size_t cnt); 
0 votes
answered Feb 7 by Shahriyor Yuldashev (690 points)

In c++ programming language, there are so many libraries. And printf() is in stdio.h (ctdio) library. Most common library is iostream. And you can print text using this library. std::cout<<"Any text";

0 votes
answered Feb 10 by Namsani Venkatesh (140 points)
we can use puts() instead of printf().

Implementation of puts() is easier than printf().
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.