【发布时间】:2015-04-10 18:32:21
【问题描述】:
我的代码正在使用整数值,但是当我尝试添加字符值时,出现错误。
这是我的代码:
1 #include <stdio.h>
2
3 struct _pointer{
4
5 int x;
6 int y;
7 char Q[200];
8
9 }address,*pointer;
10
11
12 main()
13 {
14 pointer = &address; // here we give the pointer the address.
15 pointer->x = 10; // here we give the pointer the value to variable x.
16 pointer->y = 30; // here we give the pointer the value to variable y.
17 (*pointer).Q = "BANGO!";
18 printf("The x variable is %d\nThe y variable is %d\nTheText\n",pointer-> x,pointer->y,pointer->Q);
19
20 }
21
那么我的错误在哪里?
谢谢
【问题讨论】:
-
你想做什么?