🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: pl.comp.programming
1 messages
1 total messages Started by cyb... Lukasz Dyszy Fri, 23 Feb 1996 00:00
klopoty z realloc() w BC
#368
Author: cyb... Lukasz Dyszy
Date: Fri, 23 Feb 1996 00:00
32 lines
1136 bytes
//Czesc moze ktos mi powie co ja robie zle w tym programie
//ale jak na moj gust to realloc() cos nie dziala tak jak powinien
//obajwy sa takie ze elementy tablicy tab przy wyprowadzaniu sa nie
//takie jakie powinny byc tzn. nie sa takie jakie byly wprowadzone
//heapcheck() mowi ze sterta jest OK. ta ze ja juz nie wiem co jest
//grane ... moze ktos z was spotkal sie kiedys z podobnym problemem
//i wie co jest grane ..
//
// Lukasz Dyszy   IRC: CyBorG        A fool with a tool is still a fool.


#include <iostream.h>
#include <alloc.h>
#include <stdlib.h>


void main(void)
{
int *tab=NULL;

for (int i=0; i<20; i++)
  {
  tab=(int *)realloc(tab, i+1);
  if (tab==NULL)
    exit(1);
  *(tab+i)=i;
  }

for (i=0; i<20; i++)
  cout << *(tab+i) << ' ';
}
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads