Anonymous
Please suggest me a way so that it can work
Don't use cin >> ques
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
Anonymous
Abhishek
Anonymous
Your code is not readable. You should format it better
Anonymous
Then the string will not store the spaces
Then you need OS specific extensions to accept input
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
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
code is here
Dima
code is here
oh, wrap your case/break into a scope
Dima
case 1: { int secim2 ………. break; }
Wisenky
so, why?
got it fixed ?
Emir
got it fixed ?
yep, but i dont know why
Khoiruzi
Hi, I'm from Indonesia
Wisenky
hey @Neko_cpp would you lead me if you are available ?
Francisco
yep, but i dont know why
A switch is a unique scope. There's no different scopes for every case
فاطمهَ 💛
what exactly is happening in these two lines? how did they be changed?
فاطمهَ 💛
فاطمهَ 💛
this is the output
فاطمهَ 💛
This code is SO bad
so, do you have any ideas for my question?
Anonymous
so, do you have any ideas for my question?
Learn about differences between increment operators and how they work with pointers
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
??? Are you there?
Yeah sorry was eating
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
Anonymous
what exactly is happening in these two lines? how did they be changed?
Thats printing the integer value of the memory position that retrun from ++ step on the pointer variable One of them will be the original mem location and one of them will be the momory location + 1 So ugly code
فاطمهَ 💛
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?
فاطمهَ 💛
this is the output
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
the program didn't say there is a mistake
compilers don't detect undefined behaviour. that is a consequence of being "undefined"
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
Only available in clang