2022.5.6

/* 2022.5.6*/
/* lethead2.c */
//#include <stdio.h>
//#include <string.h>               /* 为 strlen */
//#define NAME "GIGATHINK, INC."
//#define ADDRESS "101 megabuck plaza"
//#define PLACE "megapolis, CA 94904"
//#define WIDTH 40
//#define SPACE ''
//
//void show_n_char(char ch, int num);
//
//int main(void)
//{
//    int spaces;
//
//    show_n_char('*', WIDTH);                /* 用符号常量作为参数 */
//    putchar('\n');
//    show_n_char( ' ', 12);                 /* 用符号常量作为参数 */
//    printf("%s\n", NAME);
//    spaces = (WIDTH - strlen(ADDRESS)) / 2;      /* 计算要跳过多少个空格 */
//
//    show_n_char( ' ', spaces);                /* 用一个变量作为参数*/
//    show_n_char('*', WIDTH);
//    putchar('\n');
//
//    return 0;
//}
//
///* show_n_cahr()函数的定义 */
//void show_n_char(char ch, int num)
//{
//    int count;
//
//    for (count = 1; count <= num; count++)
//        putchar(ch);
//}


/* lesser.c -- 找出两个整数中较小的一个--------------------------------------------------不对 */
//#include <stdio.h>
//int imin(int, int);
//
//int main(void)
//{
//    int evi11, evi12;
//
//    printf("enter a pair of integers (q to quit): \n");
//    while (scanf("%d %d", &evi12) == 2)
//    {
//        printf("the lesser of %d and %d id %d.\n", evi11, evi12, imin(evi11, evi12));
//        printf("enter a pair of integers (q to quit) :\n");
//    }
//
//    printf("bye.\n");
//
//    return 0;
//}
//
//int imin(int n, int m)
//{
//    int min;
//      
//    if (n < m)
//        min = n;
//    else
//        min = m;
//
//    return min;
//
//}


/* 错误地使用函数 ----------------------------------------------------------------------不对*/
//#include <stdio.h>
//int imax();         /* 旧式函数声明 */
//
//int main(void)
//{
//    printf("the maximun of %d and %d is %d.\n", 3, 5, imax(3));
//    printf("the maximun of %d and %d is %d.\n", 3, 5, imax(3.0, 5.0));
//
//    return 0;
//}
//
//int imax(n, m)
//int n, m;
//{
//    return  (n > m ? n : m);
//}


/* proto.c -- 使用函数原型------------------------------------------------------------------不对 */
//#include <stdio.h>
//int imax(int, int);             /* 函数原型 */
//int main(void)
//{
//    printf("the maximun of %d and %d is %d.\n", 3, 5, imax(3));
//    printf("the maximun of %d and %d is %d.\n", 3, 5, imax(3.0, 5.0));
//
//    return 0;
//}
//
//int imax(int n, int m)
//{
//    return (n > m ? n : m);
//}


/* recur.c -- 递归演示 */
#include <stdio.h>
void up_and_down(int);

int main()
{
    up_and_down(1);
    return 0;
}

void up_and_down(int n)
{
    printf("level %d: n location %p\n", n, &n); /* #1 */
    if (n < 4)
        up_and_down(n + 1);
    printf("LEVEL %d: n location %p\n", n, &n); /* #2 */

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值