answersLogoWhite

0


Best Answer

You would iterate over all characters within the string, printing each character with the putchar function. In C, strings are terminated with a null byte, so you'd stop when that null byte has been reached.

Example:

void printme(const char* me) {

while (*me) {

putchar(*me++);

}

}

Needless to say this method is inefficient compared to using API that outputs the entire string at once, but the general approach of iterating over all characters in a string is used frequently.

User Avatar

Wiki User

12y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

12y ago

if v write the data directly into video memory then will need not to have any display function.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How do you print a string using putchar?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

How do you do a string print?

You would iterate over all characters within the string, printing each character with the putchar function. In C, strings are terminated with a null byte, so you'd stop when that null byte has been reached. Example: void printme(const char* me) { while (*me) { putchar(*me++); } } Needless to say this method is inefficient compared to using API that outputs the entire string at once, but the general approach of iterating over all characters in a string is used frequently.


How do you print on console without using printf or puts in c language?

write, putchar, putc, fputc etc


How do you print double quote sign in c?

putchar ('"'); puts ("""); etc


How will you print percent in c language?

putchar ('%'); puts ("%"); printf ("%%"); etc...


What is the printf in c?

Printf is a function which can output a "string literal," which means that unlike its similiar, putchar, it can in fact print entire sentences, including formatted data. Also, it's defined in stdio.h.


Write c program to print palindrome using string without using strrev strlen strcam?

sdfdg


How do you Print all the first characters in the string in python programming?

Let's say your string is a variable called "string" To print out all the characters in order, you would do: for i in string: print(string[i]) If you wanted to print out characters up to a point (n = maximum characters): for i in range(n): print(string[i]) hope this helps!


What are the differences between puts and fputs?

All three functions output a single character, either to the console or to a FILE. putc() takes a character argument, and outputs it to the specified FILE. fputc() does exactly the same thing, and differs from putc() in implementation only. Most people use fputc(). putchar() writes the character to the console, and is the same as calling putc(c, stdout). puts() is a multicharacter function and putchar() is single character function


What is putchar function in c?

putchar used to write one character to output device Example putchar (variable_name); #include<stdio.h> void main() { char alpha='x'; clrscr(); putchar(alpha); putchar('\n'); /*or*/ putchar('\Y'); getch(); }


Write a c program using string concept enter a sting and replace the new string in to old string and find no of occurrence?

print c co com comp compu


Take input of string reverse the strring in python?

There are five common methods of string inversion in Python: using string slicing, using recursion, using the list reverse () method, using stack and using for loop. Use string slicing (most concise) s = "hello" reversed_ s = s[::-1] print(reversed_s) >>> olleh Use recursive def reverse_ it(string): if len(string)==0: return string else: return reverse_ it(string[1:]) + string[0] print "added " + string[0] string1 = "the crazy programmer" string2 = reverse_ it(string1) print "original = " + string1 print "reversed = " + string2 Use the list reverse() method in [25]: l = ['a', 'B', 'C','d '] ...: l.reverse() ...: print (l) ['d', 'c', 'b', 'a'] Using stack def Rev_ string(a_string): L = list (a_string) # simulate all stacking new_ string = "" while len(l)>0: new_ String + = l.pop() # simulate stack out return new_ string Use the for loop #for loop def func(s): r = "" max_ index = len(s) - 1 for index,value in enumerate(s): r += s[max_index-index] return r r = func(s) The above are the five common methods of string inversion in Python. I hope it can be helpful to your learning of Python strings


Why php Echo not printing output with parenthesis?

echo will not return output when using parenthesis because echo is not a function like print. echo is a language construct. The benefit to using echo over the print function is speed, plus you can separate data types using comma's rather than periods.Example:echo 'This is a string ' , $variable , ' ending string';is the same (but faster) as:print('This is a sting' . $variable . ' ending string');