printing a string in stdout in c using pointers

Solutions on MaxInterview for printing a string in stdout in c using pointers by the best coders in the world

showing results for - "printing a string in stdout in c using pointers"
Rashan
13 Mar 2016
1/**
2* PRINTS A STRING TO STDOUT USING PUTS()
3* Desc: Prints a string on stdout
4*/
5
6#include <stdio.h>
7
8/**
9* _puts - Reads string pointers
10* @i: counter var
11* @s: string read
12*/
13void _puts(char *s)
14{
15        int i = 0;
16
17        while (s[i])
18        {
19                putchar(s[i]);
20                i++;
21        }
22}
23
24/**
25* main - start of the prog
26* @*str: str to be read
27*/
28int main(void)
29{
30    char *str;
31
32    str = "I do not fear computers. I fear the lack of them - Isaac Asimov";
33    _puts(str);
34    return (0);
35}