【发布时间】:2009-09-12 02:25:05
【问题描述】:
我正在尝试在 C 中创建一个函数,该函数将打印一个作为参数的字符串。这在 C 语言中是否可行?
我的头文件中有类似的内容,但字符串不是有效的标识符。我知道 C 中没有字符串,但是 string.h 类是干什么用的?
#include <string.h>
#ifndef _NEWMAIN_H
#define _NEWMAIN_H
#ifdef __cplusplus
extern "C" {
#endif
void print (string message){ //this is where i need help
printf("%s", message);
}
#ifdef __cplusplus
}
#endif
#endif /* _NEWMAIN_H */
【问题讨论】:
-
谢谢大家。我学到了一些新东西。