delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/04/25/11:16:48

From: leger_v AT bluewin DOT ch
Newsgroups: comp.os.msdos.djgpp
Subject: Problem with malloc() and integers
Date: Sat, 25 Apr 1998 17:02:56 +0200
Organization: Swisscom AG, the blue window
Lines: 16
Message-ID: <3541FB20.3606@bluewin.ch>
NNTP-Posting-Host: sio22pub69.bluewin.ch
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Hi,

I want to use the malloc function with integers or longs pointers.
But if I use them instead of chars pointers, the program crash.

1)unsigned char *test[10];
  for(i=0;i<10;i++)test[i]=(unsigned char *)malloc(64000);

2)unsigned int (or long) *test[10];
  for(i=0;i<10;i++)test[i]=(unsigned int (or long) *)malloc(64000);

The 1) works fine. But the 2) not : I obtain "exiting duing signal 
SISEGV". What's the problem ? How much memory can we allocate ?

Thanx,
Patrick

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019