allocate space for typedef data type

From: Janice (no_at_mail.com)
Date: 11/08/04


Date: Tue, 9 Nov 2004 02:25:41 +0800

Always get segmentation fault for the following code.
If the data is primitive type instead, it will be fine.
What is the problem?
Thanx

main(){
typedef int pid_t;
pid_t pid=12;
pid_t* ary;
int count=0;
ary=(pid_t*)realloc(ary,(count+1)*sizeof(pid_t));
*(ary+count)=pid;
}