您好,欢迎来到微智科技网。
搜索
您的当前位置:首页两层指针的参数

两层指针的参数

来源:微智科技网
#cat redirect.h
#ifndef REDIRECT_PTR_H
#define REDIRECT_PTR_H

extern void get_a_day(const char **);

#endif
#cat redirect.c
#include "redirect_prt.h"

static const char *msg[] = {
    "Sunday","Monday","Tuesday","Thursday","Friday","Saturday"
};

void get_a_day(const char **pp){
    static int i = 0;
    *pp = msg[i%7];
    i++;
}
#cat main.c
#include <stdio.h>
#include "redirect.h"

int main(void){
    const char *firstday = NULL;
    const char *secondday = NULL;
    get_a_day(&firstday);
    get_a_day(&secondday);
    printf("%s\t%s\n",firstday,secondday);
    return 0;
}

转载于:https://www.cnblogs.com/muahao/p/7224770.html

因篇幅问题不能全部显示,请点此查看更多更全内容

Copyright © 2019- 7swz.com 版权所有 赣ICP备2024042798号-8

违法及侵权请联系:TEL:199 18 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务