answersLogoWhite

0

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

Still curious? Ask our experts.

Chat with our AI personalities

JordanJordan
Looking for a career mentor? I've seen my fair share of shake-ups.
Chat with Jordan
LaoLao
The path is yours to walk; I am only here to hold up a mirror.
Chat with Lao
DevinDevin
I've poured enough drinks to know that people don't always want advice—they just want to talk.
Chat with Devin
More answers

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

User Avatar

Wiki User

12y ago
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