Search:

Type: Posts; User: iceaway

Page 1 of 6 1 2 3 4

Search: Search took 0.01 seconds.

  1. Replies
    13
    Views
    1,764

    A linked list cannot be represented by an array...

    A linked list cannot be represented by an array like you are trying to do, it is a different data structure. In the simplest form it is a structure containing a value and a pointer to the next...
  2. Replies
    1
    Views
    982

    You can use two nested loops, where the outer one...

    You can use two nested loops, where the outer one loops through the rows and the inner one the columns, where the counter variables represent the current row and column. Something like:


    int i,...
  3. Replies
    8
    Views
    1,608

    Show us the code you have so far.

    Show us the code you have so far.
  4. Replies
    13
    Views
    4,936

    What sort of programming are you interested in?...

    What sort of programming are you interested in? Low level stuff? Kernel development? GUI applications?
  5. Replies
    13
    Views
    1,764

    You must know the size of your array. You don't...

    You must know the size of your array. You don't necessarily have to know how large it is going to be at compile time, it can be allocated and resized dynamically at run time using malloc/realloc, but...
  6. No. Drop the #define at the top, instead write ...

    No. Drop the #define at the top, instead write



    /* This is the function definition, you need this if the function is defined after it is used */
    void Simulation(void);

    int main(void) /*...
  7. It's called "calling a function".

    It's called "calling a function".
  8. Oh you mean the name of '}'? :) Curly bracket, or...

    Oh you mean the name of '}'? :) Curly bracket, or curly brace, I think.

    Link
  9. You seem to be calling Simulation from your main...

    You seem to be calling Simulation from your main loop but the function definition says it's called simulaition. C is case sensitive, and the spelling is wrong in the definition.
  10. Thread: & and no &

    by iceaway
    Replies
    3
    Views
    1,025

    You should (almost) never use & with printf, as...

    You should (almost) never use & with printf, as it takes the value of its arguments, not a pointer (except when using strings...). You should (almost) always use & with scanf as it need to write to...
  11. Replies
    4
    Views
    898

    You need to open a new file for writing using...

    You need to open a new file for writing using fopen, then you write to it using fprintf (almost identical syntax to printf) and close it again with fclose. Or you can do what Salem says and redirect...
  12. Replies
    4
    Views
    898

    Make it a tab or comma separated file, you can...

    Make it a tab or comma separated file, you can import that to excel.
  13. Replies
    3
    Views
    920

    The string you are writing to s contains 6...

    The string you are writing to s contains 6 elements (remember the terminating null character), but you only allocated memory for 5.
  14. Replies
    4
    Views
    960

    Do you have any code at all to start with? You...

    Do you have any code at all to start with? You could at least write a skeleton which has a main function and the string-replace function.
  15. Thread: I/O Help

    by iceaway
    Replies
    15
    Views
    2,467

    You should close the FILE pointers, not the file...

    You should close the FILE pointers, not the file names. i.e., fclose(dataIn) rather than fclose(dataInName). You cannot "close" a string :-)
  16. Replies
    7
    Views
    973

    What are you having problems with?

    What are you having problems with?
  17. Replies
    13
    Views
    3,023

    I'm still getting this error: warning:...

    I'm still getting this error:


    warning: format '%e' expects type 'float *', but argument 2 has type 'double *'


    The format specifier for a double in scanf is %lf, and for printf it is %f. Try...
  18. Replies
    11
    Views
    12,002

    I rarely do anything with strings, so I'm not the...

    I rarely do anything with strings, so I'm not the person to answer that question. Hopefully CommonTater will come around soon, he should have some advice on this matter.
  19. Replies
    11
    Views
    12,002

    It is because you are trying to put characters...

    It is because you are trying to put characters which aren't in the ASCII-table into a char. Encoding is a headache, look into things like UTF-8, unicode etc. if you want to know more about it. The...
  20. Replies
    8
    Views
    1,376

    You already know what a and b is at the end of...

    You already know what a and b is at the end of function2, 5 and 2. function2 returns 2*a - b, which would be 10 - 2 = 8. The return value from function2 is assigned to variable b in main. Since...
  21. Replies
    8
    Views
    1,376

    Try to do what I just did. Comment the code, line...

    Try to do what I just did. Comment the code, line by line (or do it on paper) to get a feeling of what happens. The second line to be printed is the call to printf just after the call to function2()....
  22. Replies
    4
    Views
    2,206

    I think this belongs in the C++ forum.

    I think this belongs in the C++ forum.
  23. Replies
    8
    Views
    1,376

    I commented the code below for you: int...

    I commented the code below for you:



    int function2(int a, int b) { /* called with a = 1, b = 2 */
    int temp = a+b; /* temp = a + b = 1 + 2 = 3 */
    ...
  24. Replies
    8
    Views
    1,376

    The first thing that will be printed is the...

    The first thing that will be printed is the printf-statement in function2(...). You know the parameter values passed to function2, so just follow the statements in each row, writing down the contents...
  25. Replies
    8
    Views
    1,244

    When the string literal "%d" is used as an...

    When the string literal "%d" is used as an argument to printf, it becomes a pointer to the address of the string. So when +1 is added to it, the pointer adress is incremented by one and points to "d"...
Results 1 to 25 of 133
Page 1 of 6 1 2 3 4