C Language Blog Job--function nested call

Source: Internet
Author: User

First, the experimental work 1.1 PTA topic 6-4 Decimal Conversion binary 1. Design ideas
定义x用于存储每一位二进制数    若n<2,输出n,    否则x=n%2存储2进制数,再次调用该函数    输出x
2. Code

3. Debugging issues
    • The main problem is the function exit error, and then carefully read the code to find problems
1.2 Student performance Management System 1.2.1 Drawing function module diagram, Brief introduction function function

1.2.2 Show your project documents

1.2.3 Function Code Section



1.2.4 Debug Results show



New students
Query students

1.2.5 debugging encountered problems and solutions.

This problem still has a lot of function not to realize, wait for me to follow slowly perfect ....

Second, this week's topic set PTA Final Ranking

Third, read the code

/1. A man drove a duck to every village to sell, and every village sold one half of the Ducks he drove.
So he had two ducks left after seven villages and asked him how many ducks he had to drive out? After
How many ducks are sold in each village?
/

#include <stdio.h>  int f(int n)  {  int num;  if(n==8)//第7个村子过后,也就是到第八个村子时还有2只鸭  {  return 2;  }  else  {  num =(f(n+1)+1)*2; //递归调用  printf("第%d个村子卖鸭子%d只\n",n,num/2+1);  }  return num;  }  int main()  {  int num = f(1);  printf("总共赶鸭子%d个\n",num);  return 0;  }  

This problem also has a do not use recursive function of the hair, more complex, two-phase comparison can reflect the superiority of recursion

Iv. Summary of this week's study
    • Array of pointers can hold multiple character arrays, each element in the pointer array is the first address of a character array, and the pointer array name is a level two pointer
    • A pointer to a pointer that represents a second-level pointer
    • The malloc () function can define dynamic memory to avoid wasted memory and finally free up memory with
Learning experience
    • This week to learn to build a project, which is more difficult than the PTA on the topic, put so many functions together, it is necessary to consider more things

C Language Blog Job--function nested call

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.