print a string using recursion in c
#include <stdio.h> /** * rec - a function that prints a string * Desc: use recursion to print a string one letter at a time */ void rec(char *s) { if (*s == '\0') return; printf("%c", *s); rec(s + 1); } /** * main - start of this program * Desc: implements on rec() * Return 0 on success */ int main() { char str[100] = "My test string"; rec(str); return 0; }