我正在尝试创建一个方法 ( proc),以保证在取消引用未初始化的指针时交换将崩溃。
我想要的是,当没有分配内存时,程序崩溃。
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
void swap (int *px, int *py) {
    int *temp;
    *temp = *px; // Why doesn't this crash?
    *px = *py;
    *py = *temp;
}
int main() {
    int a = 99999;
    int b = -0;
    int c = 0;
    //proc(/* Some args might go here */);
    swap(&a, &b);
    printf("%d\n", a);
    printf("%d\n", b);
}