Search:

Type: Posts; User: Zainny

Page 1 of 2 1 2

Search: Search took 0.01 seconds.

  1. Replies
    3
    Views
    3,285

    Here is a crazy idea that seems to have caught on...

    Here is a crazy idea that seems to have caught on in this day and age:
    Google
  2. Very simply, you need to reinitialise the...

    Very simply, you need to reinitialise the variables high_score and low_score at the start of every quiz. Thus, you should have:


    low_score = 11;
    high_score = -1;


    directly underneath where...
  3. Replies
    15
    Views
    4,224

    Mak, There are a couple of reasons. A good...

    Mak,

    There are a couple of reasons. A good read is available at
    http://home.att.net/~jackklein/ctips01.html#int_main

    The following local FAQ version also provides some points:...
  4. Replies
    15
    Views
    4,224

    Mak, You should make the mentioned changed to...

    Mak,

    You should make the mentioned changed to your code.

    In addition, use main in the following manner:


    int main() {
    /* code here */
  5. Replies
    15
    Views
    4,224

    R.Stiltskin, Firstly, instead of ...

    R.Stiltskin,

    Firstly, instead of
    scanf("%s",&oldstr); it should read
    scanf("%s", oldstr);

    Next, there is no need to continually set newstr[4] to '\0', this only needs to be done once at...
  6. Replies
    3
    Views
    3,153

    Can I suggest a number of changes? ...

    Can I suggest a number of changes?



    #include <stdio.h>

    int main() {
    float temp;
    int counter = 0;
    float max;
  7. Thread: assignment help

    by Zainny
    Replies
    4
    Views
    1,326

    You didn't actually specify that the individual...

    You didn't actually specify that the individual numbers have to be positive hence there could be an infinite number of solutions:

    eg. Given a single valid solution:
    K = p + q + r, then it holds...
  8. Replies
    5
    Views
    1,322

    Absolutely. Sorry if I appeared to be bagging you...

    Absolutely. Sorry if I appeared to be bagging you out, it certainly wasn't my intention.

    As for isspace, it is in <ctype.h> and will return a non-zero value for any non-space character (0x09 -...
  9. Replies
    5
    Views
    1,322

    Ahh....What is the purpose of deleting the...

    Ahh....What is the purpose of deleting the previous space and then printing a new one?

    The code given in K&R2 is, after detecting a space, print it, and then ignore any following spaces (which is...
  10. Replies
    6
    Views
    2,528

    JamesM, Since you are using a structure,...

    JamesM,

    Since you are using a structure, rather than define teamname in the structure as char *teamname, instead make it char teamname[n], where n is an adequate size to store the largest team...
  11. Replies
    6
    Views
    2,528

    When you use scanf (and any variants - fscanf,...

    When you use scanf (and any variants - fscanf, sscanf) for reading into variables, the result of any conversion is stored directly at the memory address given for that variable. Thus, if data (such...
  12. Replies
    4
    Views
    1,030

    Yep. Nothing special going on here.

    Yep. Nothing special going on here.
  13. Thread: structures

    by Zainny
    Replies
    10
    Views
    1,326

    Should be: int otherfunction(struct test *);

    Should be:


    int otherfunction(struct test *);
  14. Replies
    7
    Views
    1,144

    Example code: #include int...

    Example code:



    #include <stdio.h>

    int getValue(int, int, int *args[]);

    int main() {
    int *Nn[2];
  15. Thread: structures

    by Zainny
    Replies
    10
    Views
    1,326

    Doh! Just shows, you shouldn't post after a hard...

    Doh! Just shows, you shouldn't post after a hard night of drinking

    Apologies for the incorrect information Gav D.
  16. Replies
    7
    Views
    1,144

    Say we have an array of pointers: Let's take the...

    Say we have an array of pointers: Let's take the example of an array of character pointers:



    char getValue(int i, int j, char *args[]) {
    return args[i - 1][j - 1];
    }


    This seems too...
  17. Thread: structures

    by Zainny
    Replies
    10
    Views
    1,326

    No. The most common reason for passing a pointer...

    No.
    The most common reason for passing a pointer to a structure rather than the structure itself for a function call is to conserve space on the stack.
  18. Thread: structures

    by Zainny
    Replies
    10
    Views
    1,326

    EDIT: POSTED TOO EARLY ACCIDENTALLY Firstly,...

    EDIT: POSTED TOO EARLY ACCIDENTALLY

    Firstly, it is probably best to keep the structure definition outside of main then create the declaration in main.



    /* structure definition */
    struct...
  19. Replies
    3
    Views
    1,452

    A quick search produced this page, which I think...

    A quick search produced this page, which I think is what you were after:

    http://cboard.cprogramming.com/showthread.php?s=&threadid=42094&highlight=string+function+call

    Cheers,
    Z.
  20. Replies
    5
    Views
    1,265

    Here is a good page that answers all your...

    Here is a good page that answers all your questions:

    http://www.purdue.edu/PUCC/Short-Courses/c.files/p_00200.html

    Cheers,
    Z.
  21. Thread: Copying struct

    by Zainny
    Replies
    16
    Views
    2,957

    Read the above.

    Read the above.
  22. Thread: Copying struct

    by Zainny
    Replies
    16
    Views
    2,957

    Don't worry. Just checked Comp.Lang.C FAQ and...

    Don't worry. Just checked Comp.Lang.C FAQ and found this:



    The more you know!
  23. Thread: Copying struct

    by Zainny
    Replies
    16
    Views
    2,957

    I remember reading somewhere once that assigning...

    I remember reading somewhere once that assigning one structure to another of the same type is not guaranteed to copy the values of each of the members to the other and is compiler specific.

    Can...
  24. Replies
    7
    Views
    1,817

    Yes. In that section I was linking each of the...

    Yes. In that section I was linking each of the elements of the linked list together.

    Salem is of course correct in asserting that my approach is a very poor way of forming a linked list and in...
  25. Replies
    7
    Views
    1,817

    I'm not sure exactly what you were after, but...

    I'm not sure exactly what you were after, but here is the very quick correction I whipped up.



    #include <stdio.h>
    #include <stdlib.h>

    /*Structure declaration*/
    struct employee {
    char...
Results 1 to 25 of 32
Page 1 of 2 1 2