Search:

Type: Posts; User: f97tosc

Search: Search took 0.01 seconds.

  1. Replies
    13
    Views
    1,738

    Try running this function void...

    Try running this function



    void trymax(void)
    {
    int i;
    for(i=1;i<25;i++)
    {
    GetVal(i);
  2. Replies
    13
    Views
    1,738

    Re: Re: HUm again

    No of course you can't input a number that is greater than the limit.

    But in addition, if your program somwhere generates a number that is larger than the limit, then you are in trouble as well.
    ...
  3. Replies
    13
    Views
    1,738

    HUm again

    Well, what is really needed is to find the

    biggest n, such that n! <= limit_value

    Even if you know limit_value from limit.h or whatever, that does not tell you what your biggest input value n...
  4. Replies
    13
    Views
    1,738

    Hum

    I would have to disagree with the previous answers.

    Factorials grow extremely fast, so I doubt you will be able to reach n=50 before you will overflow, regardless of whether you use doubles or...
  5. Replies
    1
    Views
    1,325

    Sorry for premature posting

    I need to process data from a file with the following format:



    41.877430 0.200000 0.200000 1.000000 1
    42.339146 0.200000 0.200000 0.400000 1
    42.507645 1.000000 1.000000 0.400000 1 ...
  6. Replies
    1
    Views
    1,325

    Reading and using numbers from a file

    Hi all,
  7. Replies
    11
    Views
    1,584

    Thanks a lot

    I really appreciate the time and effort. I think I am finally getting this thing to work...

    Best,

    Tor
  8. Replies
    11
    Views
    1,584

    Thanks Stumon

    That was comprenhensive and very useful.

    2 follow up questions



    //to allocate memory to a multidimensional array of pointers.
    matrices[0][0] = malloc(sizeof(float));
  9. Replies
    11
    Views
    1,584

    Clarification

    Yes, if I know the size from the start, then I don't need malloc.

    So let's clarify one final (?) time


    float (* fun_matrix)[5];
    .
    .
    .
    size_of_matrix = complex_calculation();
  10. Replies
    11
    Views
    1,584

    Sorry, missed something

    I should have cleaned up my exxample better. This is what I meant. The goal is to produce a 10x5 matrix of floats.

    8<-------------------
    float (* fun_matrix)[5];
    .
    .
    .
    *fun_matrix= malloc(10*...
  11. Replies
    11
    Views
    1,584

    Memory leaks and bad indeces: use of malloc

    Hi all,

    this is a follow-up on my questions about segmentation fault that was generated when I tried to write data in an output file.

    Thanks everybody that responded to that, I think that I...
  12. Replies
    9
    Views
    10,749

    Update

    By moving around the "Hello world" statement I have moved closer to a resolution.

    The program consists of several separately compiled .o but linked .o files.


    OK:
    outfile = fopen("Data.out",...
  13. Replies
    9
    Views
    10,749

    Source code

    OK, in the beginning of main we have

    FILE *infile, *outfile;

    main(int argc, char *argv[])
    {
    outfile = fopen(argv[2], "w");

    fprintf(outfile, "Hello world\n");
  14. Replies
    9
    Views
    10,749

    Mysterious fprintf problem

    I have experienced some mysterious problems when trying to write something into a file.

    The output file is created by fopen in the beginning of the program. The idea is at the end of the run I...
  15. Replies
    2
    Views
    1,151

    Thanks

    That was quick and really useful.

    Best,

    Tor
  16. Replies
    2
    Views
    1,151

    2 Array questions

    1 Is there anyway to automatically get slices of arrays?

    For example, from the array {1 2 3 4 5 6} is there any quick way of getting say elements 2-4 in a new array {2 3 4}?


    2 Dynamic array...
  17. Replies
    3
    Views
    1,961

    Thanks, that was helpful

    Tor
  18. Replies
    3
    Views
    1,961

    Thanks, that helped. What about arguments?

    Thanks a lot vVv, that helped a lot.

    Now, what if I want to use arguments for the objects?

    I know that for my executable a.out, I can send in arguments with argv/argc. These go to the main...
  19. Replies
    3
    Views
    1,961

    Linking C files (Unix)

    Hi, I am working on a growing c program in a Unix environment.

    I have a main program which is linked to some other programs through header files. I compile them all at once as follows

    gcc...
Results 1 to 19 of 19