allocate space for typedef data type
From: Janice (no_at_mail.com)
Date: 11/08/04
- Next message: James Dennett: "Re: allocate space for typedef data type"
- Previous message: Chris: "Re: Dynamic arrays"
- Next in thread: James Dennett: "Re: allocate space for typedef data type"
- Reply: James Dennett: "Re: allocate space for typedef data type"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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;
}
- Next message: James Dennett: "Re: allocate space for typedef data type"
- Previous message: Chris: "Re: Dynamic arrays"
- Next in thread: James Dennett: "Re: allocate space for typedef data type"
- Reply: James Dennett: "Re: allocate space for typedef data type"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]