Mar!o
Yes. They are like void *const because their address cannot be changed afterwards to they also point to the same object.
Mar!o
So how are they different from static type pointers?
Raw pointers can be null, so prefer them if you want a nullable parameter. Also pointer arithmetic is not possible with references, neither rebinding. Also derefencing is implicit!
Mar!o
But remember there is a big difference between l-value references like: int&, r-value references like: int&& and forwarding references like: T&&
Mar!o
Oh okay right. I'm not in that state of the art :P But It's also possible to overload methods for l and r value references, which is pertty awesome!
Mar!o
In good old C we only have pointers :)
YD👺
Hi
YD👺
How can I edit a command package in linux
Narendra Modi
Hello everyone , I am a beginner , Can you pls tell me how to limit the integer values , while taking inputs from a file in a c program
YD👺
What do you mean? 🤔
Do not you know (ls)??
Renan
Do not you know (ls)??
I mean, could you be more specific. 😅 👍
Narendra Modi
What do you mean? 🤔
I am taking input of integers in a c program from a text file ,text file has 20 values , can you pls tell how , how can i limit the value of taking only starting 7integers
YD👺
I mean, could you be more specific. 😅 👍
I want to change the command name from ls to list
@Chhotu
Why warning rose
Narendra Modi
u can input an char array scanf(“%7s”, array); is that work?
well let me try , but i want to take input of integers , will it work for integers
Renan
yess
You just have to read 7 lines of the file. Assuming the file looks like this: 54 654 12 5 ...
Renan
If not, specify the format.
@Chhotu
Write the name of feature of object oriented programming used in the following program jointly illustrated by the function (I) to 4.
Renan
I think you can post paste bin. 🤔
Narendra Modi
Emir
yess you are right , 22 44 33 55 77 44 77 44 in this format
scanf(“%d %d %d %d…); you can do that like this
Emir
but if only one spaces between two integers
Narendra Modi
Open and read a file of integers into an array that is created with the first integer telling you how many to read. So 4 9 11 12 15 would mean create an int array size 4 and read in the remaining 4 values into data[]. Then compute their average as a double and their max as an int. Print all this out neatly to the screen and to an output file named answer-hw3. this was the whole question , I have to solve , I know the rest , but can't understand how to solve the second line
Dima
1, 3. bruh
Francisco
1, 3. bruh
Rose is in glitch mode
Narendra Modi
OK...
Can you help?
Renan
Can you help?
Yes. I am writing the example code.
Narendra Modi
Renan
okk , thank you so much
Here: https://pastebin.com/pj79pCAy I hope it is correct. 😅 👍
Tiakuh_San
Im comparing two arrays that I've returned from a function but im having a issue
Tiakuh_San
I have to loop each array item but i need a way to make it stop withou acessing unwanted memory.
Tiakuh_San
Is there a way i can mark the array end?
Tiakuh_San
So in the loop it breaks when reaching it?
Tiakuh_San
I have it returning 2, 5, 172737383, 373737373, the only useful values are in the the 0 and 1 position
Renan
I have it returning 2, 5, 172737383, 373737373, the only useful values are in the the 0 and 1 position
There must be a way to know the array size, include it as parameter. This cannot be guessed.
Tiakuh_San
Thats the thing, the array is created dinamically. I do not know where this ends...unless i can mark its end in the array (like a null value or something) or return both the array and an counter
Taylor Rose
why, after clearing the line, I have so much indentation there, to write a new value, where str and output are the lines
Tiakuh_San
What if i mark as a negative value? ,🤔
Taylor Rose
I have the result written in the string in 'output', and I need to 'output' the entire value to '\n' and save it in "str", and then delete the string str and write it again to '\n'
Tiakuh_San
I was able to work with it using a -1. But i will revisit this situation again
Tiakuh_San
I do define the max lenght, but not all of it is being used... if the array is 100 but the values I need are only the first 5, then i will access values that i dont want if i define the sizeof array right? At least that was my output...a lot of trash after the good values...
❣️
❣️
Answer for this?
Francisco
Answer for this?
What have you done so far? I hope you don't expect us to do it for you
Narendra Modi
Here: https://pastebin.com/pj79pCAy I hope it is correct. 😅 👍
Yes it is fully correct , but I didn't get how count got its value , Can you pls explain
Dima
Answer for this?
/warn read the rules
Renan
Yes it is fully correct , but I didn't get how count got its value , Can you pls explain
On line 41-49, count gets its value from the first integer from file, as you said. 👍
YK Y
please suggest any good tutorial for bitmask?
Alion🦁
Hi, guys
Alion🦁
Where I can find C++ tests?
Dima
because its international
Tushar Goel
#include <stdio.h> #include <string.h> int main() { int a; scanf("%d",&a); getchar(); char c[20]; gets(c); printf("%d\n",a); puts(c); return 0; }
Tushar Goel
what is the use of getchar
Tushar Goel
Sorry
Tushar Goel
I am asking what is the use of getchar()
Emir
Emir
reading just one character
char ch; ch = getchar(); Like this
Tushar Goel
char ch; ch = getchar(); Like this
I mean what getchar did in this program
Emir
This program is wait until press some key because of getchar
Tushar Goel
Sorry for the but can you please elaborate
Emir
Sorry for the but can you please elaborate
https://en.wikibooks.org/wiki/C_Programming/stdio.h/getchar You can read this article
Tushar Goel
https://en.wikibooks.org/wiki/C_Programming/stdio.h/getchar You can read this article
Okay got it. So if I had'nt used getchar in this program ,compiler would'nt executed the gets(c) statement . Can you explain why?
Emir
Okay got it. So if I had'nt used getchar in this program ,compiler would'nt executed the gets(c) statement . Can you explain why?
i think getchar function is clearing stdin, but im not sure, i will check and i will come back to you