Helloe all
I have this small program using switch statment.
the problem that when I complie this C code using gcc under Linux I get message: switch guantity not integer!!
Now, when I use switch(*hello) instead switch(hello), I got run time error: segmentation fault!!
I want to know where is the problem?
#include <stdio.h>
main()
{
int *hello;
printf("Hi, Enter any value > ");
scanf("%d",&hello);
switch (hello)
{
case 1: printf("your 1 luck number is > %d\n",hello);
case 2: printf("your 2 luck number is > %d\n",hello);
case 3: printf("your 3 luck number is > %d\n",hello);
default: printf("your 4 luck number is > %d\n",hello);
}
}
thanks