[INFO ] [Logger ] Record log in C:\Users\USER\.kivy\logs\kivy_18-10-27_52.txt
[INFO ] [Kivy ] v1.10.1
[INFO ] [Python ] v3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC v.1914 64 bit (AMD64)]
[INFO ] [Factory ] 194 symbols loaded
[INFO ] [Image ] Providers: img_tex, img_dds, img_sdl2, img_pil, img_gif (img_ffpyplayer ignored)
[INFO ] [Text ] Provider: sdl2
[INFO ] [Window ] Provider: sdl2
[INFO ] [Window ] Activate GLES2/ANGLE context
[CRITICAL] [Window ] Unable to find any valuable Window provider.
sdl2 - RuntimeError: b'Could not initialize OpenGL / GLES library'
File "C:\Users\USER\AppData\Local\Programs\Python\Python37\lib\site-
packages\kivy\core\__init__.py", line 67, in core_select_lib
cls = cls()
File "C:\Users\USER\AppData\Local\Programs\Python\Python37\lib\site-
packages\kivy\core\window\window_sdl2.py", line 140, in __init__
super(WindowSDL, self).__init__()
File "C:\Users\USER\AppData\Local\Programs\Python\Python37\lib\site-
packages\kivy\core\window\__init__.py", line 968, in __init__
self.create_window()
File "C:\Users\USER\AppData\Local\Programs\Python\Python37\lib\site-
packages\kivy\core\window\window_sdl2.py", line 272, in create_window
self.fullscreen, resizable, state)
File "kivy\core\window\_window_sdl2.pyx", line 209, in
kivy.core.window._window_sdl2._WindowSDL2Storage.setup_window
File "kivy\core\window\_window_sdl2.pyx", line 66, in
kivy.core.window._window_sdl2._WindowSDL2Storage.die
[CRITICAL] [App ] Unable to get a Window, abort.
你好,我想从用户那里得到输入。用户何时输入-1号,我想打破这个循环。但是我收到一些错误代码:““ HelloC.exe中0x53918F0E(ucrtbased.dll)的未处理异常:0xC0000005:访问冲突写入位置0xCCCCCCCC。”
我的错在哪里? 当我尝试将函数类型从void更改为int时,得到相同的错误。
答案 0 :(得分:0)
问题很少,首先是这个
scanf("%d", param[i]);
应该是
scanf("%d", ¶m[i]); /* need to provide address */
buildArray()
原型也应该
void buildArray(int *);
代替
void buildArray();
同样do..while
条件错误,请在循环的条件部分中使用param[i-1]
代替param[i]
。
示例代码
void buildArray(int param[]) {
int i = 0;
do {
printf("Please enter number :");
scanf("%d", ¶m[i]);
printf("entered : %d\n", param[i]);
i++; /* because of this, condition part should be param[i-1] != -1 */
}while(param[i-1] != -1); /* it should be param[i-1] */
}