rg2c+@andrew.cmu.edu (Robert Nelson Gasch) (02/17/91)
Thanks alot to all the people who responded to my array queestion that I posted about 10 days ago. Below is a short summary of the subject I was inquiring about: When using arrays there are two legal ways of declaring them: 1) int this_array[10]; which explicitly defines the array. Straight forward. 2) int *this_ptr; this_ptr = (int *) malloc (10 * sizeof (int)); which explicitly allocates the space for 10 integers, beginning at the address pointed to by this_ptr. Here is a version which *may* work on your system for reasons such as compiler design and pure luck. It is however NOT SAFE and your chances of crashing the system seem to be quite good. int *this_ptr; this_ptr [0] = 1; this_ptr [1] = 2; . . . this_ptr [9] = 10; Here you are storing data in memory locations pointed to by this_ptr. Since this_ptr was never initialized, it could point anywhere. Again, this might work but don't use it since from what people have told me it seems that the chances of crashing your system are bigger than the chances of it working. Thanx again to all those who responded. ---> Rob