Search:

Type: Posts; User: ChwanRen

Search: Search took 0.01 seconds.

  1. Replies
    0
    Views
    1,766

    Weird modification to string length

    // Structure declaration and type definition
    struct wordsRec {
    int type;
    // 0 represents non-number, 1 represents numbers.
    char value[4];
    };
    typedef struct wordsRec Words;

    int...
  2. I find this weird: &(*circ).radius Because...

    I find this weird: &(*circ).radius

    Because isn't it saying the address of the value pointed to by the circ pointer? Shouldn't circ return the same thing?
  3. A pointer to a member of an array of structures

    int main(void)
    {
    struct circle circle[MAXCIRCLES]
    getCircle(&circle[1]);
    }

    void getCircle(struct circle *circ)
    {
    printf("Centre: ");
    scanf("%f, %f", &(*circ).centre.x,...
  4. Replies
    4
    Views
    1,013

    Reading in an int followed by a string

    Why is it that the following code:

    printf("? ");
    scanf("%d", &n);
    printf("? ");
    gets(str);

    skip the gets(str) step?

    My guess is that the carriage return is not stored into n and still in...
  5. Replies
    4
    Views
    1,509

    Edit: yeah it works... thanks alot man. Going to...

    Edit: yeah it works... thanks alot man. Going to look up what the %[ specifier does exactly now. Mind explaining how it works in detail?

    thanks anyway.
  6. Replies
    4
    Views
    1,509

    Reading data from files

    I have a text file with the following lines:

    1 | Matrix | 1 | Action | 3
    2 | X-men 2 | 1 | Action | 2
    .
    .
    .
    id | movie name | rental type | genre | stock

    I want to read the data from the...
Results 1 to 6 of 6