Anonymous
How?
Artöm
Oof
Anonymous
??
Artöm
if (scanf("%d", &y) != 1) fputs("y wasn't read", stderr);
Artöm
Like this
Artöm
Or using debugger
Anonymous
Where can I use them
Artöm
Whom?
Anonymous
Debuggers
Рома
use getch();
Artöm
google gdb usage
Wagdi Alarifee
Q . char der [8] = {a,s,g}; cout 《der [5]; what output ..
Anonymous
Garbage value probably.
Anonymous
Everything can be the output
Wagdi Alarifee
wow ..
Wagdi Alarifee
Q . int der [8] = {1,3,6}; cout 《der [5]; what output ..
Wagdi Alarifee
7
why ..
Anonymous
why ..
No reason
Wagdi Alarifee
why 7 .. or 5 ..
Anonymous
No reason
Stop confusing beginners. It's totally not cool. 🙄
Wagdi Alarifee
0 will be the answer
I am try it .. but it char .. not result ..
Wagdi Alarifee
. channel youtue to leranning ..
Wagdi Alarifee
thanks ..
Anonymous
thanks ..
no problem ...
Wagdi Alarifee
I have eaxm after two weeks .. I reviwe see that .. any reason ture ..
Anonymous
Dima
What the hell
Artöm
Well, he left
Anonymous
/stop
Anonymous
/begin
Anonymous
/ban
MilkBeforeCereal
bruh
Anonymous
bruh
Yes
n1coc4cola
/begin
n1coc4cola
?
n1coc4cola
/begin
Ariana
Wouldn't it be &x+&y
i too would like leaking esp
Ariana
Q . char der [8] = {a,s,g}; cout 《der [5]; what output ..
you know you could always just run the code right ¯\_(ツ)_/¯
14•08
14•08
/warn
😁😁😁
Anonymous
These are troll questions.
Seems like just a confused beginner. The person who's calling everyone a troll is you
shivi
if (scanf("%d", &y) != 1) fputs("y wasn't read", stderr);
Listen use %f at the place of %d then u will easily enter decimal value from user
Anonymous
Anonymous
Nothing is printed
isn't a null byte printed?
桃桃乌龙
what is a null byte
桃桃乌龙
did you mean ‘\0’ ?
olli
Garbage
Wrong, the array is initialized so the value is well defined
olli
These are troll questions.
troll or not, I think these questions can be interesting because a lot of people get them wrong
olli
You mean undefined.
no, it's 0 as stated per 6.7.9.21 in N1570
Anonymous
no, it's 0 as stated per 6.7.9.21 in N1570
That's when it's declared outside of functions
olli
21. If there are fewer initializers in a brace-enclosed list than there are elements or members of an aggregate, or fewer characters in a string literal used to initialize an array of known size than there are elements in the array, the remainder of the aggregate shall be initialized implicitly the same as objects that have static storage duration.
Sid Sun
Language: Cpp_gcc Source: #include <iostream> int main (){ char der [8] = {'a','s','g'}; std::cout << der [5]; return 0; } Result: ␀
Anonymous
yeah, thought so
olli
That's when it's declared outside of functions
read the standard or the excerpt above
Sid Sun
These questions are stupid, they prove nothing, have no practical use and are not required by anybody for anything
Pavel
Q . char der [8] = {a,s,g}; cout 《der [5]; what output ..
https://stackoverflow.com/questions/1065774/initialization-of-a-normal-array-with-one-default-value
Sid Sun
I disagree,it's good to know what the language defines.
Where could you possibly use this in a practical sense?
olli
Where could you possibly use this in a practical sense?
create an array and initialize with 0 int array[100] = {};
olli
Where could you possibly use this in a practical sense?
Additionally it's good to know that int array[100]; is not the same as int array[100] = {};
Pavel
Where could you possibly use this in a practical sense?
Reading and understanding some legacy code of your project. Job interviews
olli
I kinda disagree on job interviews though, I would not refuse to hire someone for not knowing this. Imho interview questions should show the actual skill/thinking process and not knowledge about a language. Otherwise you can end up with people learning interview questions but not really understanding them
olli
Most interviews are silly
I never had a silly one ¯\_(ツ)_/¯