Search:

Type: Posts; User: peterchen

Page 1 of 3 1 2 3

Search: Search took 0.01 seconds.

  1. fgets(ex_str, sizeof ex_str, stdin); reads...

    fgets(ex_str, sizeof ex_str, stdin);

    reads input from standard input and stores it in ex_str, the sizeof ex_str argument ensures no overflow occurs.

    from code it looks like your trying to read...
  2. Replies
    8
    Views
    946

    i don't see anything wrong, so it might be your...

    i don't see anything wrong, so it might be your ide.

    try running this



    #include <stdio.h>

    int main(int argc, char *argv[]) {
    int lines = 0;
  3. Replies
    5
    Views
    1,155

    post agenda.dat so i can do some tests

    post agenda.dat so i can do some tests
  4. Replies
    13
    Views
    1,685

    "hard to solve" sure got my attention. i had...

    "hard to solve" sure got my attention.

    i had the exact same problem when i first looked into c.
  5. Replies
    2
    Views
    975

    this has already been answered go to link below...

    this has already been answered go to link below
    http://cboard.cprogramming.com/showthread.php?t=87167
  6. #include #include #include...

    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    #define MAX 30
    struct ValueList
    {
    char valuename[MAX]; /* change valuename to value */
    struct ValueList *value; /*...
  7. Replies
    7
    Views
    1,501

    e.g char *func(char a[], char b[]) { ...

    e.g


    char *func(char a[], char b[]) {
    int i=0;
    while(*b!='\0') {
    *(a+i)=*b;
    b++;
    i++;
    }
  8. Replies
    7
    Views
    1,501

    you know grumpy is right the mistakes you have...

    you know grumpy is right

    the mistakes you have made are easy to fix if you just go through it. the code isn't that long and the same mistakes are made over and over again.

    for example

    ...
  9. Replies
    2
    Views
    830

    where is main? (will make much easier to debug)...

    where is main? (will make much easier to debug)
    is length synonym to number_of_players?
    why length = 20? (it's pointless because of what comes next)

    you will need malloc(size_t); to achieve what...
  10. Replies
    4
    Views
    1,751

    you need to get sweepValue a value before using...

    you need to get sweepValue a value before using it in an expression.

    e.g float sweepValue = 0;

    also delay doesn't seem to have been defined.
  11. Replies
    5
    Views
    1,023

    1. the function names should be different to the...

    1. the function names should be different to the array names. that is change the function names
    2. change



    int b;
    for (b=0;b<a;b++)
    (c+b)=*(d+b);
  12. sorry about that. try fgets(char_array,...

    sorry about that.

    try fgets(char_array, max_number_char, sdtin)

    as vart pointed out.

    or put

    getchar();
    which removes '\n' from stdin
  13. Replies
    12
    Views
    1,263

    regarding float a = 0.7f; if(a == 0.7f) ...

    regarding


    float a = 0.7f;
    if(a == 0.7f)
    printf("First");
    else
    printf("Second");
  14. Replies
    12
    Views
    1,263

    note just realized it doesn't work for negative...

    note just realized it doesn't work for negative nums
  15. try %[^\n] instead of %s scanf("%s",...

    try %[^\n] instead of %s

    scanf("%s", char_array_name);
    stores the characters from stdin into char_array_name until white space is encountered.

    scanf("%[^\n]", char_array_name);
    stores the...
  16. Replies
    5
    Views
    1,304

    Those questions are the fundamentals of C. It...

    Those questions are the fundamentals of C.

    It would be bad for you if i told you the answers.

    However, i will point you in the right direction.

    -->...
  17. Thread: strcmp???

    by peterchen
    Replies
    7
    Views
    13,317

    no it would not simply because the arguments...

    no it would not

    simply because the arguments to strcmp needs to be char *

    if you want to compare variables that are characters simply use the relational operators ==, !=, >, <, >= or <= as you...
  18. look at the function definition for fopen. ...

    look at the function definition for fopen.

    FILE *fopen(const char *FILE, const char *MODE);

    the second argument to fopen is string pointer.

    if you put r,w or rw the complier thinks it is a...
  19. Replies
    6
    Views
    1,021

    you need to initialize sum to zero aswell

    you need to initialize sum to zero aswell
  20. Replies
    15
    Views
    14,904

    1. 42339 is not a 6 digit number 2. if you...

    1. 42339 is not a 6 digit number
    2. if you multiply each digit by 2 you get 5 numbers 8 4 6 6 18 where did the other 6 come from.

    not a very good specification.
  21. Replies
    10
    Views
    1,484

    check if the number is between 9999 and 100000...

    check if the number is between 9999
    and 100000 exclusive



    if(input > 9999 && input < 100000) {
    /* your code continues */


    a better way is to store the input as a string instead of an...
  22. Thread: strcpy

    by peterchen
    Replies
    7
    Views
    1,835

    the two string functions strcpy and strcmp are...

    the two string functions strcpy and strcmp are completely different functions.

    the difference is strcpy copies a string to an array, whereas strcmp compares the two strings for order.

    for...
  23. you need to know that '1' is not equivalent to 1....

    you need to know that '1' is not equivalent to 1.

    see this link: http://www.lookuptables.com/

    '1' is a character represented in ansii and has a corresponding int value - 49. so c == '1' is same...
  24. Replies
    9
    Views
    1,226

    if i'm not mistaken, two consecutive newline...

    if i'm not mistaken, two consecutive newline characters is a blank line.
  25. Replies
    7
    Views
    1,554

    changing the value pointed to by a pointer

    #include <stdio.h>

    void alphabet(char *);

    int main(void) {
    alphabet("a");

    system("PAUSE");
    return 0;
    }
Results 1 to 25 of 67
Page 1 of 3 1 2 3