【发布时间】:2021-12-12 19:13:44
【问题描述】:
# how to declare string in prototype?
void myfunction(???,int);
# function that uses a string, call it like this...
void myfunction("hello world", int i)
{
code ...
}
我尝试在原型中声明字符串,但未成功 char、char[*]等
仅供参考,我尝试原型化的实际程序代码是
SDL_Window* win* = SDL_CreateWindow("Hello World!", 100, 100, 620, 387, SDL_WINDOW_SHOWN);
【问题讨论】:
-
const char*是您将使用的类型声明。 -
来自the docs:
SDL_Window * SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint32 flags); -
void myfunction(const char* str, int whatever); -
@JHBonarius 不过,从 1990 年代初期开始,这似乎是一个非常过时的学习资源。不建议初学者随便看网上乱七八糟的教程。