Anonymous
Anonymous
If you use getline after cin>> the newline left in the input stream is read by getline
Anonymous
And it thinks it is done
Anonymous
You can fix this very easily
Anonymous
cin >> ques;
string temp;
getline(cin,temp);
Anonymous
This is not a very elegant fix and you should remove the cin>> itself and use getline then convert to integer internally
Anonymous
Another fix is to use cin>> everywhere instead of getline
Anonymous
And the best fix is to use a library like GNU readline to accept input safely and convert internally
Abhishek
Anonymous
Abhishek
Anonymous
Your code is not readable. You should format it better
Abhishek
Abhishek
Like I just also fuck up while choosing variable names
Anonymous
Write a c program using structure to distance between two points.
Help please
I_Interface
Anonymous
I_Interface
Are u kidding?
I_Interface
So rude...
Dima
you gotta be polite
Dima
it is not cool asking like that
Serenity
{
FILE* fp1;
fp1 = fopen(argv[1], "r");
}
Serenity
Why does it throw an error ? What have I done wrong ?
Wisenky
guys , why it doesnt counts even for loop is working ??
Wisenky
Emir
odev.c:81:4: error: a label can only be part of a statement and a declaration is not a statement
81 | int secim2;
| ^~~
What is my fault?
Emir
Dima
oh, wrap your case/break into a scope
Dima
case 1: { int secim2 ………. break; }
Emir
Wisenky
Khoiruzi
Hi, I'm from Indonesia
Wisenky
hey @Neko_cpp would you lead me if you are available ?
فاطمهَ 💛
what exactly is happening in these two lines? how did they be changed?
فاطمهَ 💛
فاطمهَ 💛
this is the output
Anonymous
فاطمهَ 💛
Anonymous
Hi I need to ask something
I compiled a program with SCS, how to verify it was compiled with it?
Anonymous
Assume arm64
Anonymous
Shadow call stack
Anonymous
It protects against linear and non linear buffer overflows
Anonymous
The only stable implementation is on arm64
Anonymous
It is a stronger alternative to -fstack-protector-all
Anonymous
Yeah
Anonymous
It's only supported on android 10 right now
Anonymous
Though compiler-rt provides an implementation
Anonymous
??? Are you there?
Anonymous
???
Dima
lol
Anonymous
Well just wanted to check if the final code ends up actually using scs
Anonymous
That's all
Anonymous
I added -ffixed-x18 -fsanitize=shadow-call-stack globally in the makefile
فاطمهَ 💛
according to the videos from YouTube the last line has to be 2, 5 but the output says it's 7,5 so what did I miss?
فاطمهَ 💛
Anonymous
Anonymous
you are initialising an int * with an int (*)[4]
Anonymous
int *p = p_arr;
int *q = q_arr;
فاطمهَ 💛
the program didn't say there is a mistake
Asdew
That's because you're the programmer, not the "program" or the compiler.
Anonymous
however, you can increase the warning level to get some hints about undefined behaviour in your code
Anonymous
but remember that those don't work always
Anonymous
add -Wall -Wextra -pedantic flags
Asdew
I myself also use -Werror (along with the ones Chandradeep mentioned).
فاطمهَ 💛
okay thank you
Anonymous
Hi
Anonymous
I'm new
Anonymous
okay thank you
btw, since you seem to be learning the basics and not doing actual work, setting -std=c18 (instead of the gnu default) will let you stick to the international standard better. it will block GNU specific extensions to the C standard (the -pedantic flag bitches about non standard behaviour too)
Asdew
You can change c18 to your preferred version of C (I recommend C89 or C99, they're widely supported by various compilers).
فاطمهَ 💛
Anonymous
Anonymous
Only available in clang