why can't we take an array :- a[10000000]??
what is the alternative?
pooh1234qwerty
0
Newbie Poster
Recommended Answers
Jump to PostIn addition to Trentacle's questions, I would also ask, what compiler are you using, under what kind of system? The reason I ask is because, while a ten million item array is almost certainly excessive, it should be possible to declare and use one under a modern 32-bit or 64-bit …
Jump to Postalternative is malloc
you will locate it on heap instead of stack or calloc effect is same bot you haveto free it after and it can be dinamically changed during execution :)
Jump to PostI noticed a serious bug in the program: you are allocating
ptr
based on an uninitialized value forn
, which means that the size of ptr could be nearly anything. You'll need to read inn
first, then allocateptr
, and only after that should you …
Jump to PostActually, let's start over with new variable names, just to make it clearer, and add some test prints to show what is happening at each stage. I did this and was able to get the program working, in fact:
#include<stdio.h> #include<stdlib.h> int main() { int iterations, initial_tax_years, …
All 15 Replies
Trentacle
112
Junior Poster in Training
Schol-R-LEA
1,446
Commie Mutant Traitor
Featured Poster
Ancient Dragon
commented:
great answer :)
+14
Sokurenko
42
Junior Poster
Ancient Dragon
commented:
right answer :)
+14
pooh1234qwerty
0
Newbie Poster
Schol-R-LEA
1,446
Commie Mutant Traitor
Featured Poster
pooh1234qwerty
0
Newbie Poster
Schol-R-LEA
1,446
Commie Mutant Traitor
Featured Poster
pooh1234qwerty
0
Newbie Poster
Schol-R-LEA
1,446
Commie Mutant Traitor
Featured Poster
pooh1234qwerty
0
Newbie Poster
Sokurenko
42
Junior Poster
Schol-R-LEA
1,446
Commie Mutant Traitor
Featured Poster
pooh1234qwerty
0
Newbie Poster
Schol-R-LEA
1,446
Commie Mutant Traitor
Featured Poster
pooh1234qwerty
0
Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.