|
Jacavienna wrote: osc(buffer,amp,freq,wave,&ndx);
What is "buffer", "freq", etc., Simply, what is that you want?
Jacavienna wrote: input[220,440,660];
What's that?
I think I'm almost done with you.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
there's alot to it lol....it's just controls for the synth....
if you still wanna know send us a message and i'll send you the stuff you need to make it work ie soundio.cpp oscil.cpp and ftables.cpp these all make up the definations of the synth i'm just using them..
|
|
|
|
|
So...you get num from the user. You want to allocate an array of that size, then get num values from the user and put them into the array?
This should do:
#include <stdio.h>
int main(int argc, char** argv)
{
int num;
printf("Number of frequencies?\n");
scanf("%d", &num);
int* freq = new int[num];
for(int i=0;i<num;++i)
{
printf("Frequency %d?\n", i);
scanf("%d", freq+i);
}
delete[] freq;
}
As Cedric said, you're probably better off using std::vector .
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Select "Ignore HTML tags in this message (good for code snippets)" from the bottom of your screen so that we are able to see the code in proper way.
Secondly, you can ask the user to input a number, say "num". Now you can loop upto num times.'
I hope I read your question correctly
You need to google first, if you have "It's urgent please" mentioned in your question.
_AnShUmAn_
|
|
|
|
|
If you are talking about dynamic array
means size of array get change at run time
then you can't declare array this way.
You have to take pointer of int array
And use melloc & realloc method for dynamic allocation.
If this is not what you are asking then please clarify your question.
regards,
Divyang Mithaiwala
Software Engineer
|
|
|
|
|
cool thanks a mill for responding....i don't know much about malloc (tho we did touch on it in class)....
thing is the loop in working and it's sending the amount of freq but not the values...i have the array set at [44] so the user shouldn't go out of bounds....so your saying this won't work ...is there any other way?? ie without using malloc...assignment is in at 4 today so i don't have time to look into how malloc functions ....what i have should be enough but would be better if i could get it to play multiple freqs .... thanks again
|
|
|
|
|
If you want a dynamic array, I suggest you take a look at a std::vetor.
|
|
|
|
|
hey i have the std::vector function but what do i need to access it ie where does <pre> #include <vector> </pre> come from? do i need to download something??
|
|
|
|
|
Jacavienna wrote: std::vector function
It's not a function, it's a class (template).
You have to #include <vector> . Here[^] is a small guide to get you started with the STL. If you are still stuck after that, try googling for vector tutorials.
|
|
|
|
|
Jacavienna wrote: how do i incurment the array as the number changes??
array[l]
Check out the subscript operator.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
i need a application which carry all desktop setting means folder and files ,
which carry my documeunt and any personal data and go to any guest pc and do any updation there and come back in you pc and sync and you found all updation there .give a sample like that
or can any body help me
|
|
|
|
|
How much are you ready to shell out of your pocket?
AshNis wrote: i need a application which carry all desktop setting means folder and files ,
which carry my documeunt and any personal data and go to any guest pc and do any updation there and come back in you pc and sync and you found all updation there .give a sample like that
wow! the application goes to guest pc, does the updation and come back to your pc.... interesting
You need to google first, if you have "It's urgent please" mentioned in your question.
_AnShUmAn_
|
|
|
|
|
Live Mesh[^]
May be of use to you! I've not used it myself, but I hear good things about it...
Or a memory stick?
Iain.
In the process of moving to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), give me a job!
|
|
|
|
|
Hi,
I have created CStatic object in my MFC application.I have allocated memory to it.If I delete static variable It is giving breakpoint.I am unable to delete CStatic object.Can anyone help me.
|
|
|
|
|
What do you mean by "It is giving breakpoint"? Do you mean that it is failing an ASSERT? If yes, where and what?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
It is showing corruption of heap.
|
|
|
|
|
So you created a static like this: mystatic = new CStatis; , and deleted it like this: delete mystatis; and you get something like "the heap around whatever has been corrupted"?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
I have created member variable CStatic *m_myStatic ;,I am allocating memory like this m_myStatic = new CStatic[m_filecount];, and I am deleting in destructor.It is showing breakpoint is due to corruption of heap.
|
|
|
|
|
How are you deleting it ?
like this : delete [] m_myStatic;
This signature was proudly tested on animals.
|
|
|
|
|
I see, well, you need to delete an array -as Maximilien already pointed out- like this: delete []m_myStatic; . Otherwise, heap corruption can be caused by indexing out of your array, so you try to write items in the array which are not in the array at all, for example:
int *int_array = new int[5];
int_array[10] = 4;
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
This is not related at all. How you use an array has nothing to do with how you destroy it.
|
|
|
|
|
He said he gets "corruption of heap", that -as far as i know- can be caused by what i said there. The question wasn't specifically "how to delete an array".
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
Code-o-mat wrote: He said he gets "corruption of heap"...
When he deletes, not accesses.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Correct me when i am wrong but -at least in debug- when you allocate an array using new, the system will allocate somewhat more bytes than explicitly needed by your array and will place some special information infront and after your block. When you delete the array the system will check these special values infront and after the array and if it does not find what it expects it will complain about it because this probably means you wrote to memory you should not have written to. True, the example there was a bad one, i should have wrote int_array[5] = 4; instead of int_array[10] = 4; , because 10 is WAY after the lest element of the array...
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
How unbelievable it might seem, there are even more ways to corrupt a piece of memory than there are unspecific questions on this forum
|
|
|
|