Path: utzoo!mnetor!uunet!husc6!mailrus!ames!umd5!brl-adm!adm!jfjr@mitre-bedford.arpa From: jfjr@mitre-bedford.arpa (Freedman) Newsgroups: comp.lang.c Subject: arrays and structures in C Message-ID: <12983@brl-adm.ARPA> Date: 15 Apr 88 13:19:13 GMT Sender: news@brl-adm.ARPA Lines: 38 I've asked similar questions so if this sound familiar please bear with me. Suppose I have some (rather large) type and I want to dynamically allocate a (rather large) array of said type. The natural way to do this is sort like this malloc(some_large_integer*(sizeof(rather_large_type))). But given some well known architectures this ties the compiler hands - it must allocate contiguous storage. Alternatively you could declare typedef rather_large_type large_array[some_large_integer]; but I haven't had much luck with malloc(sizeof(large_array)) Now I can do this typedef struct { int dummy_field; large_array large; } large_structure; malloc(sizeof(large_structure)) this seems to work and looks more portable than anything else but its not pretty. Have I missed something?? signed Continuously Confused Jerry Freedman, Jr "Love is staying up all night jfjr@mitre-bedford.arpa with a sick child, (617)271-4563 or a healthy adult"