递归与递归树
逆序打印字符串 void printReverseString(const char* str){ if(*str == '\0'){ return; } printReverseString(str + 1); printf("%c", *str); } int main() { const char* str = "Hello World"; printReverseString(str); // dlroW olleH return 0; } 逆序输出链表 struct LinkNode{ int data; struct LinkNode* next; }; void printReverseLinkNode(struct LinkNode* header){ if(header == NULL){ return; } printReverseLinkNode(header->next); printf("%d\n", header->data); } int main() { struct LinkNode* header = malloc(sizeof(struct LinkNode)); struct LinkNode* node1 = malloc(sizeof(struct LinkNode)); node1->data = 10; node1->next = NULL; struct LinkNode* node2 = malloc(sizeof(struct LinkNode)); node2->data = 20; node2->next = NULL; struct LinkNode* node3 = malloc(sizeof(struct LinkNode)); node3->data = 30; node3->next = NULL; header->next = node1; node1->next = node2; node2->next = node3; printReverseLinkNode(header->next); return 0; } 递归实现给出一个数 8793,依次打印千位数 8、百位数 7、十位数 9、个位数 3...