这是什么意思的typedef? [英] What does this typedef mean?

查看:133
本文介绍了这是什么意思的typedef?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新的C,而这类型定义看起来有点怪我。有人可以解释它做什么?

I am new to C, and this typedef looks a little bit strange to me. Can someone explain what it does?

typedef void (*alpm_cb_log)(alpm_loglevel_t, const char *, va_list);

这是一个头文件。

It is in a header file.

推荐答案

一个简单的例子。
声明:

A Simple example. Declaration:

typedef int myint.

使用:

myint number = 7;

敏为int的同义词

您的例子

typedef void (*alpm_cb_log)(alpm_loglevel_t, const char *, va_list);

这是一个指向函数

(*alpm_cb_log)

的参数是

(alpm_loglevel_t, const char *, va_list)

和不返回任何东西。

void 

与使用的typedef的一般规则是写出来的声明,如果
你宣称要

The general rule with the use of typedef is to write out a declaration as if you were declaring variables of the types that you want

这篇关于这是什么意思的typedef?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆