segmentation faults
jwantz at hpcc2.hpcc.noaa.gov
jwantz at hpcc2.hpcc.noaa.gov
Wed Aug 29 12:32:33 EDT 2001
Hi Everybody,
Sorry if someone has covered this already--but pointers in C are behind
everything. If you are referencing an array element like array[i] its
very similar to *(array+i). Keep in mind though pointers are variables
like any other, you have to assign them a value before they will work. If
you don't you'll get a segmentation violation for sure because it will
attempt to execute whatever junk value is in the pointer. Under MSDOS
this would invariably lead to your machine locking up. Under UNIX systems
though its smart enough to recognize that you are attempting to write
outside of your permitted memory area. If your writing kernel or driver
code though and you do this you are running your CPU in supervisory mode
which means that you are permitted to do anything. As I am sure Kirk
would tell you BE CAREFUL!!!!!
Jim Wantz WB0TFK
More information about the Speakup
mailing list