| | |
Need major help
Please support our C++ advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Oct 2005
Posts: 8
Reputation:
Solved Threads: 0
i have to convert a program from c++ to C language and at one point in my program im stuck where its dealing with dynamic memory of an array. i started it but i dont know how u do dynamic memomory in c language.
C++ Syntax (Toggle Plain Text)
if (reply == '1') { printf("Enter the 1st score (any invalid score to quit): "); scanf("%d", score); while (score >= 0 && score <= 100) { ++numOfScores; if (numOfScores > arraySize) { arraySize = int(1.5*arraySize + 1); scoresArrayPtrHold = scoresArrayPtr; scoresArrayPtr = new int [arraySize]; for (int i = 0; i < numOfScores - 1; ++i) *(scoresArrayPtr + i) = *(scoresArrayPtrHold + i); free(scoresArrayPtrHold); scoresArrayPtrHold = 0; } *(scoresArrayPtr + numOfScores - 1) = score; printf("Enter the next score (any invalid score to end): "); scanf("%d", score); }
Last edited by Dave Sinkula; Nov 14th, 2005 at 10:25 pm. Reason: Added [code][/code] tags.
•
•
•
•
Originally Posted by bucsoldier03
how do i get to the tutoriols
"One of the methods used by statists to destroy capitalism consists in establishing controls that tie a given industry hand and foot, making it unable to solve its problems, then declaring that freedom has failed and stronger controls are necessary." --Ayn Rand
And don't forget
free(), which I'm sure is mentioned in the tutorial. dwk
Seek and ye shall find.
"Only those who will risk going too far can possibly find out how far one can go."
-- TS Eliot.
"I have not failed. I've just found 10,000 ways that won't work."
-- Thomas Alva Edison
"The only real mistake is the one from which we learn nothing."
-- John Powell
Seek and ye shall find.
"Only those who will risk going too far can possibly find out how far one can go."
-- TS Eliot.
"I have not failed. I've just found 10,000 ways that won't work."
-- Thomas Alva Edison
"The only real mistake is the one from which we learn nothing."
-- John Powell
![]() |
Similar Threads
- Should I major? (Computer Science)
- In Need Of Major Help (Networking Hardware Configuration)
- Major XP Problem: Error Loading Operating System... (Windows NT / 2000 / XP)
- MAJOR probs lop (Viruses, Spyware and other Nasties)
- Major Explorer problems (Windows 95 / 98 / Me)
- Computer MAJOR lag (Troubleshooting Dead Machines)
- Alright, Computer Science major... take it or not? (IT Professionals' Lounge)
Other Threads in the C++ Forum
- Previous Thread: just a little help needed
- Next Thread: a real challenge this time
Views: 1828 | Replies: 7
| Thread Tools | Search this Thread |
Tag cloud for C++
6 api application array arrays assignment beginner binary bitmap c++ c/c++ calculator char class classes code coding compile compiler console conversion convert count data database delete developer display dll email encryption error file forms fstream function functions game generator getline givemetehcodez graph homeworkhelper iamthwee ifstream image input int java lazy lib loop looping loops map math matrix memory multidimensional multiple newbie news node number output parameter pointer problem program programming project proxy python random read recursion recursive reference return sort sorting string strings struct template templates text tree url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets






