who can explain a c program for me

Status
Not open for further replies.

tarkyss

Full Member level 6
Joined
Aug 1, 2005
Messages
340
Helped
26
Reputation
52
Reaction score
8
Trophy points
1,298
Location
China
Activity points
4,162
i am not familiar with C
i dont understant, Number is not defined, why can it be used?
who can explain the functions of the program for me?
thanks

int main()
{

signed int n;
/*
while(true)
{

n=0;

}
*/
getSinLDO(Number, 28 );
getSinRE(Number, 28 );
getSinMI(Number, 28 );
getSinFA(Number, 28 );
getSinSO(Number, 28 ) ;
getSinRA(Number, 28 );
getSinSI(Number, 28 );
getSinHDO(Number, 28 );

return 0;
}

getSinLDO, getSinRE and other functions are almost the same,
they are defined as follow

void getSinHDO(int vec[128], int count)
 

tarkyss said:
getSinLDO, getSinRE and other functions are almost the same,
they are defined as follow

void getSinHDO(int vec[128], int count)
Sorry, but that's not the function. It's just the forward declaration, so that the linker can check the parameters. The functions are perhaps in another C module or in a library. Can you find that out. Otherwise it's impossible to help you.


Mik
 

May be 'number' is defined as a global
Try to make a search in the project and find where it is defined
 

It seems to me like it has something to do with AUDIO --> DO RE MI FA SO LA SI DO...


You have to know what the functions are...
 

mobile-it is right
but i cannot find "number" in the program
the interation will not stop for ever,
i dont understand the function of "n" too
 

tarkyss said:
i dont understand the function of "n" too
'n' is declared, but never used. The relevant code is commented out.

Code:
/* --> beginning of comment
while(true) 
{ 

n=0; 

} 
*/  --> end of comment
 

Hi...
I am from Cuba so my inglish is not very good. It seems that thous functions...
getSinLDO(Number, 28 );
getSinRE(Number, 28 );
getSinMI(Number, 28 );
getSinFA(Number, 28 );
getSinSO(Number, 28 ) ;
getSinRA(Number, 28 );
getSinSI(Number, 28 );
getSinHDO(Number, 28 );

were mades for ganerate arrays that contain sounds, but it's implementation are not there.

At the begining of the c program most be a #include statement of the file that contain thous implementation.

This is not the full program
 

i know n is never used, but why to define n?
 

In the C language, you must define your variables before using them.

Here's a tiny example. It uses a simple getSinHDO to write 28 into array element 33:
Code:
#include <stdio.h>

void getSinHDO(int vec[128], int count)
{
  vec[33] = count;
}

int main(void)
{
  int Number[128];

  getSinHDO(Number, 28);
  printf("%d\n", Number[33]);
  return 0;
}
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…