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. :)
Type: Posts; User: koplersky
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. :)
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...
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 =...
Alright, thank you guys for the answers! ;)
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...
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....
That's it, thank you laserlight!
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;
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...
Thanks everybody and sorry for the misinterpretation. ;)
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?
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...
Oh, very nice, didn't know it could be used that way.
Thanks!
Sorry, but I've never seen an if clause being used to test an expression like this.
How does it work?
Ok, thank you Malcolm.
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!
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...
Is there a function prototype for list_dir before this?
If so maybe it's different from the function definition.
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]);
Yes, it's just a bad habit of mine. But you are right, thanks for the fix.
I see, so the difference in performance is not that much.
Thank you for the answers, and specially Adak for the fine sample code.
The problem is with this line:
scanf("%c",a[i].fakulti);
Change it to:
scanf("%c", &(a[i].fakulti));
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,...
And from this casual comment I learned a new technique, or at least the concept of something I had already done. ;)
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...