26.09.2015 Views

PROGRAMSKI JEZICI 2

Предавање 1

Предавање 1

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Dynamic memory allocation<br />

• // Izračunavanje prostog broja korišćenjem dynamic memory allocation<br />

• #include <br />

• #include <br />

• #include <br />

• int main()<br />

• { long* pprime=0; // Pointer to prime array<br />

• long trial = 5; // Candidate prime<br />

• int count = 3; // Count of primes found<br />

• int found = 0; // Indicates when a prime is found<br />

• int max = 0; // Number of primes required<br />

• cout max; // Number of primes required<br />

• if(!(pprime=new long[max]))<br />

• { cout

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!