user-0 提问: 特别简单的指针打印，出错了，大家看看是怎么回事情

回复:
user: user-1
content: 同意1楼，好好理解一下指针与内存

user: user-2
content: int *num=100;   这句是错的 int *num;只分配了指针变量的空间，并没有分配所指向区域的空间  应该 int  a; int *num = &a; *num = 100;

user: user-3
content: #include <stdio.h>                                                                                                                                                                                                                                                                                                                                                                                                          int main(void)                                                                                                                                                                                                {                                                                                                                                                                                                                 int num;                                                                                                                                                                                                     printf("input you nuber\n");                                                                                                                                                                                  scanf("%d",&num);                                                                                                                                                                                              if (!(num % 2))                                                                                                                                                                                                  printf("number %d is even\n", num);                                                                                                                                                                      else                                                                                                                                                                                                              printf("number %d is odd\n", num);                                                                                                                                                                                                                                                                                                                                                                                     return 0;                                                                                                                                                                                                 }   改成上面的代码，好好学习c语言的指针基础，别到处乱用。

user: user-0
content: 恩恩，谢谢大家。可以了。  #include <stdio.h>                                                                                                                                                                                                                                                                                                                                                                                                          int main(void)                                                                                                                                                                                                {                                                                                                                                                                                                                 int *num;                                                                                                                                                                                                     int b;                                                                                                                                                                                                        num = &b;                                                                                                                                                                                                     printf("input you nuber\n");                                                                                                                                                                                  scanf("%d",num);                                                                                                                                                                                              if (!(*num % 2))                                                                                                                                                                                                  printf("number %d is even\n", *num);                                                                                                                                                                      else                                                                                                                                                                                                              printf("number %d is odd\n", *num);                                                                                                                                                                                                                                                                                                                                                                                     return 0;                                                                                                                                                                                                 }