Search:

Type: Posts; User: skyglin

Page 1 of 2 1 2

Search: Search took 0.01 seconds.

  1. Thread: String

    by skyglin
    Replies
    4
    Views
    1,018

    the first segment of code also uses string...

    the first segment of code also uses string literals, it doesn't give me any segmentation fault...confused..
  2. Thread: String

    by skyglin
    Replies
    4
    Views
    1,018

    String

    void concat(char *s1, const char *s2)
    {

    char *p = s1;

    while (*p) ++p;

    while (*p++ = *s2++) ;

    }
  3. Thread: need help!!!

    by skyglin
    Replies
    6
    Views
    1,109

    this will work, but the numbers generated are not...

    this will work, but the numbers generated are not uniformaly distributed in the interval [-1, 1), almost all the points lies in [-1, -0.9) if 1000000 numbers are generated.

    what I did was first...
  4. Thread: need help!!!

    by skyglin
    Replies
    6
    Views
    1,109

    Thanks, I see. Now my problem is what I should...

    Thanks, I see.
    Now my problem is what I should modify so it will generate floating numbers between -1 to 1 using X(n+1) = (X(n) + X(n-1)) % 1.0. The initial two points must be in the interval [0, 1).
  5. Thread: need help!!!

    by skyglin
    Replies
    6
    Views
    1,109

    I did try with *nodePtr = fmod(*temp_x1 +...

    I did try with *nodePtr = fmod(*temp_x1 + *temp_x2, 1.0); but the 1000000 floating-point numbers generated are all in the interval [0, 1.0), so times 2 and subtract 1 should give me a result between...
  6. Thread: need help!!!

    by skyglin
    Replies
    6
    Views
    1,109

    need help!!!

    For this program, I want to generate a floating point number in the interval [-1, 1] using the formular X(n+1) = (X(n) + X(n-1)) % 1.0, however, when I print out the numbers it generated, it printed...
  7. >>>void foo( data_type array[SIZE] ) when...

    >>>void foo( data_type array[SIZE] )
    when defining this function, do I must specify the array size as SIZE (here it corresponds to number of columns) ?
  8. Passing a row of a Multidemensional Array to a function

    Let's say I have 2D array of N rows and M columns, how do pass one of the rows of this array to a function and the function can use this row as a 1D array? Thanks.
  9. Thread: Percentage

    by skyglin
    Replies
    7
    Views
    2,802

    yes, it's a status message, are there any...

    yes, it's a status message, are there any functions to do that?
  10. Thread: Percentage

    by skyglin
    Replies
    7
    Views
    2,802

    Sorry, I'm not quite understanding, can you show...

    Sorry, I'm not quite understanding, can you show me a sample code, I think it's much easier to understand from codes. Thanks
  11. Thread: Percentage

    by skyglin
    Replies
    7
    Views
    2,802

    Percentage

    I have been working on a program that calculates the minimum potential of a number of particles, the amount of time the program runs can be specifed by the user. Since the user can have the program...
  12. Replies
    1
    Views
    826

    Passing pointer to constants

    What are some of the uses of passing "pointer to constants"( int const *ci1; ) as parameters to a function? A simple example would be nice. Thanks
  13. Replies
    6
    Views
    14,655

    >>>what a union does is makes a data type whose...

    >>>what a union does is makes a data type whose members share the same physical memory space.

    How does the compiler handle the memory space if the memebers of a union occupy memory in different...
  14. Replies
    6
    Views
    14,655

    thanks, enumerated type is what I was looking...

    thanks, enumerated type is what I was looking for..
    and by the way, I haven't learned union, how do I use it?
  15. Replies
    6
    Views
    14,655

    Use struct to create a boolean type

    Since C doesn't have boolean type, I'm trying to use typedef to create a boolean data type. How do I use structure to create such boolean type (I saw somewhere, but I forgot) ?


    typdef int...
  16. Replies
    7
    Views
    1,303

    I just want to do some simple graphics components...

    I just want to do some simple graphics components like buttons, panel, textfields and some simple 2D graphics. Which graphic library is good and simple to use?
  17. Replies
    7
    Views
    1,303

    Does OpenGL include something similar to the...

    Does OpenGL include something similar to the swing library in JAVA (JButton, JTextField, JPanel, JFrame....etc)?
  18. Replies
    7
    Views
    1,303

    Can C do graphics?

    I'm kinda new to C programming, I was just wondering if C can do graphics like JAVA or C++? Are there any free graphics library for C out there?
  19. Replies
    1
    Views
    6,615

    Thanks, this is what I needed. yeah!!

    Thanks, this is what I needed. yeah!!
  20. Replies
    7
    Views
    1,422

    thanks. I understand it now.

    thanks. I understand it now.
  21. Replies
    1
    Views
    6,615

    What does "nan" mean?

    My program has a matrix of floating point values, after I performed calculations to each element in the matrix, when I print out using printf() some of the elements turned out to have the value...
  22. Replies
    7
    Views
    1,422

    >>int main( int argc, char *argv[] ) ok this...

    >>int main( int argc, char *argv[] )

    ok this is one of the standard, my question is that why do we pass two arguments to the main function, one as an int and one as a pointer to a char array. What...
  23. Replies
    6
    Views
    1,143

    Thank you for your guys' help. This site is...

    Thank you for your guys' help. This site is really helpful!
  24. Replies
    6
    Views
    1,143

    sorry, it's local/non-static. I have tried...

    sorry, it's local/non-static.

    I have tried global and it worked. Is there any way to make it work as a local array?

    How come global works but not local?

    Thanks a lot!
  25. Replies
    6
    Views
    1,143

    I have used MS Visual C++ 6.0, GCC, and MPICC to...

    I have used MS Visual C++ 6.0, GCC, and MPICC to compile. Only worked with small sized arrays.
Results 1 to 25 of 28
Page 1 of 2 1 2