Nameful
"Freestanding"?
Anonymous
Nameful
Means no library
Oh, thank you
Nameful
Does that also exclude the standard library?
olli
Does that also exclude the standard library?
http://eel.is/c++draft/compliance#:implementation,freestanding
Ludovic 'Archivist'
Does that also exclude the standard library?
Yes, freestanding only include a tiny set of headers, it is implementation defined whenever exceptions exist, and is mostly used for kernel level development and embedded development
Riya
17
No.7 Addict 👽
17
Omar
thx
Anonymous
/report screen photo and asking to solve test without trying it first
Anonymous
^o^
Anonymous
lol
Omar
y=(x!=11)?x++:x--; ?
Riya
y=(x!=11)?x++:x--; ?
What is the value of x here??
Omar
10
Merazi
y=(x!=11)?x++:x--; ?
If x=10 then y will end up being 11, right?
Anonymous
y=(x!=11)?x++:x--; ?
is it more homework?
Omar
😂😂
Omar
yes
Anonymous
oof
Riya
y=(x!=11)?x++:x--; ?
I think the answer will be 10
Omar
its my 2 week in C++
Omar
don’t think please be sure because there is mark 😂
Omar
marks*
M.Khorram
both x and y would become 11
Riya
Oh sorry y will be 10 and x will be 11
Riya
Anonymous
y=(x!=11)?x++:x--; ?
y is 10 if x is 11, otherwise y is x plus 1, since x cannot be known as its value is not known completely, only that it COULD be a specific value, and if it is this specific value, then perform Z action on X assuming it is that specific value
Anonymous
y=(x!=11)? x++:x--; is the same as
Omar
x= 10 initially you need to determine the value assigned to y
Anonymous
If (x!=11) y=x++; else y=x--;
Anonymous
In both cases observe that y=x and a change occurs in x only
Anonymous
So a compiler might rewrite this as
Anonymous
y=x (x!=11)? x++:x--;
M.Khorram
Sorry, x becomes 11 y becomes 10
Anonymous
So y=x is always true
Anonymous
And then a change occurs in x later on
Anonymous
No
Anonymous
#include <stdio.h> int main(void) { int x = 10; printf("%d", (x != 11) ? x++ : x--); printf("\n%d", x); }
Anonymous
And understand what happens
Anonymous
oh yea, its x++ and not ++x
Anonymous
so either way, y is 10 lmao
Merazi
Nice breakdown
Merazi
oh yea, its x++ and not ++x
This always gets me :[
Anonymous
Anonymous
there we go :) all nice and readable :)
Anonymous
print that out and glue it to your homework as the answer 😂😂😂😂😂
Anonymous
y=x (x!=11)? x++:x--;
@smallville7123
Anonymous
You're repeating code for no reason
Anonymous
Anonymous
No compiler is going to compile it that way either
Anonymous
y=(x!=11)? x++:x--; is the same as
but its the unoptimized translation of that :)
Anonymous
as the elvis operator is basically an if else shorthand condition ? doThisIfConditionIsTrue : doThisIfConditionIsFalse same as if (condition) { doThisIfConditionIstrue; } else { doThisIfConditionIsFalse; }
Riya
Can anyone solve this?
Manav
Do your homework yourself first
Riya
Do your homework yourself first
None of your business
Manav
None of your business
True, not my business anyways, suit yourself.
Anonymous
None of your business
After such shit attitude you expect help?
Anonymous
Anyway the solution is simple, use a std::unordered_table
Anonymous
And put values into it
ברני
Hey, is it logic if I want to make the user to decide the array size to do like that? int userSize int arr[SIZE] ; SIZE = userSize; ?
Manav
Hey, is it logic if I want to make the user to decide the array size to do like that? int userSize int arr[SIZE] ; SIZE = userSize; ?
Use malloc and create the array on heap if you want a variable sized array after getting input from user
Manav
Afaik the size of the array should be a const if you're declaring an array. But since const isn't enforced properly you never know
ברני
Use malloc and create the array on heap if you want a variable sized array after getting input from user
I don't think I got ther yet.. I'm in the task of learning array on c.. And they ask me to make the user to decide the size and then hell puts the numbers and then I need to check if the size number was in the array and how many times 🥺
Manav
VLAs are a thing
Ah yeah, you forget these if one uses C++ too much
Manav
C++ is quite weird
No u, you sire are weird XD
Anonymous
No u, you sire are weird XD
I've seen weird bs like scoped fds
Manav
I've seen weird bs like scoped fds
Welp, I can't even refute that 😔