Search:

Type: Posts; User: koplersky

Page 1 of 3 1 2 3

Search: Search took 0.01 seconds.

  1. Replies
    4
    Views
    509

    Great, thanks Soma. I was failing to see how...

    Great, thanks Soma. I was failing to see how constexpr references could be different.

    As for the auto, I had it the other way around anyway, so problem solved. :)
  2. Replies
    4
    Views
    509

    Thanks laserlight. I did check the standard, but...

    Thanks laserlight.
    I did check the standard, but it didn't help much concerning the constexpr doubt. But I'm afraid that's not a bug; I'm reading C++ Primer and it says that one can bind references...
  3. Replies
    4
    Views
    509

    constexpr and auto references

    I have some doubts about constexpr and auto when applied to references.

    From what I've read, constexpr imposes top-level const. In that case, what's the effect of doing:


    constexpr int &ref =...
  4. Replies
    38
    Views
    2,387

    Alright, thank you guys for the answers! ;)

    Alright, thank you guys for the answers! ;)
  5. Replies
    38
    Views
    2,387

    To throw or not to throw

    This is something that I've been curious about.

    What's your opinion about exceptions? Do you usually use them in your programs (those where you can write code as you like and are not tied to some...
  6. Replies
    2
    Views
    861

    Isn't the extra character a 1 and not a 4? The...

    Isn't the extra character a 1 and not a 4?

    The problem is that you are not checking the return value of fgets(). From the linked page:



    You probably have a newline at the end of your input....
  7. Replies
    6
    Views
    879

    That's it, thank you laserlight!

    That's it, thank you laserlight!
  8. Replies
    6
    Views
    879

    Get matrix indexes from the value

    Hello,

    I have a 3x3x3 matrix with values hanging from 1 to 27.
    The order is this:

    m[0][0][0] = 1;
    m[0][0][1] = 2;
    m[0][0][2] = 3;
    m[0][1][0] = 4;
    m[0][1][1] = 5;
  9. Thread: Memory in C

    by koplersky
    Replies
    3
    Views
    634

    Memory in C

    This might be a silly question, but how does memory address work in C?

    I know that in most architectures an int takes 4 bytes in memory, while a char takes 1 byte. But how does the program know...
  10. Thanks everybody and sorry for the...

    Thanks everybody and sorry for the misinterpretation. ;)
  11. Sorry, I misunderstood that part. So my...

    Sorry, I misunderstood that part.

    So my compiler returning how bigger or how smaller the value is, is just a plus and not a guaranteed result?
  12. strcmp return value on different compilers

    Hello there, I'm having a problem with the strcmp return value. My compiler returns the correct value based on my research, but I tried to compile the code below on those online compilers and the...
  13. Replies
    9
    Views
    749

    Oh, very nice, didn't know it could be used that...

    Oh, very nice, didn't know it could be used that way.
    Thanks!
  14. Replies
    9
    Views
    749

    Sorry, but I've never seen an if clause being...

    Sorry, but I've never seen an if clause being used to test an expression like this.
    How does it work?
  15. Replies
    6
    Views
    1,122

    Ok, thank you Malcolm.

    Ok, thank you Malcolm.
  16. Replies
    6
    Views
    1,122

    I was thinking about doing this on my own but I...

    I was thinking about doing this on my own but I thought there was some standard library function to do that.
    Thank you guys for the suggestions and for the help!
  17. Replies
    6
    Views
    1,122

    Print string with escape characters

    Hello there,

    This may be a silly question, but is there any function to print a string with all the escape characters in it?

    For example, instead of printing:
    This is a string.

    It would...
  18. Replies
    3
    Views
    787

    Is there a function prototype for list_dir before...

    Is there a function prototype for list_dir before this?
    If so maybe it's different from the function definition.
  19. Replies
    10
    Views
    862

    This is because you have declared the array as...

    This is because you have declared the array as int nums[10], and you are trying to print an element which is not in the array (nums[10]).
    Here's the problematic line:

    printf("%d\n",nums[10]);
  20. Thread: Struc Array

    by koplersky
    Replies
    11
    Views
    1,040

    Yes, it's just a bad habit of mine. But you are...

    Yes, it's just a bad habit of mine. But you are right, thanks for the fix.
  21. Replies
    14
    Views
    1,420

    I see, so the difference in performance is not...

    I see, so the difference in performance is not that much.

    Thank you for the answers, and specially Adak for the fine sample code.
  22. Thread: Struc Array

    by koplersky
    Replies
    11
    Views
    1,040

    The problem is with this line: ...

    The problem is with this line:


    scanf("%c",a[i].fakulti);

    Change it to:


    scanf("%c", &(a[i].fakulti));
  23. Thread: Struc Array

    by koplersky
    Replies
    11
    Views
    1,040

    Try putting the prototype of these functions...

    Try putting the prototype of these functions before main.

    int read_data(struct stud a[], int n);
    int search_data( struct stud a[], int n , int sid);

    And never declare main as returning void,...
  24. Replies
    14
    Views
    1,420

    And from this casual comment I learned a new...

    And from this casual comment I learned a new technique, or at least the concept of something I had already done. ;)
  25. Replies
    14
    Views
    1,420

    The way I understood it was that calling...

    The way I understood it was that calling functions would make the program run slower, that's why recursion came to my mind.

    Click_here this example is indeed interesting, because when I first...
Results 1 to 25 of 58
Page 1 of 3 1 2 3