Hi everyone. Suppose the following code:
The above program works fine with all types (int, float, double) but not for short. I suppose %d for shorts is not right undes Solaris 5.7?Code:void *var; int c; // c given by user... ... ... switch (c) { case 1: var = (short*)malloc(sizeof(short)); scanf("%d",(short*)var); printf("content of var: %d\n",*(short*)var); break; case 2: // same for float ... ... ... }