Anonymous
Whre the last 4 bits are related to file permition
Anonymous
But I don't know the purpose of the first 3
Zorrito
Can somone help me with GNU MP in CodeLite? I'm getting an "undefined reference error" when I use functions like gmp_printf(). I'm pretty sure I have to link my project to lgmp and/or lgmpxx, but idk how to do that.
Prince
Anonymous
Hi rose
Unknown
Completely depends on your data, if it is nearly sorted, a bubble sort will be faster than a merge sort
Ok then In what cases should I use selection sort,merge sort and insertion sort I am very much confused and this type of question is asked in interviews. How will a programmer know in advance that his data will be partially sorted of not and now its time to apply insertion sort in this case
Nikolas
!report
Dima
thx
Anonymous
why this program run in turbo cpp for 1 time main() { int a; clrscr(); for(a=1; 0; a++) { printf("%d",a); } getch(); }
Pavel
You have 0 in part that should have some condition
Anonymous
Read the rules in the pinned message, please Especially, last but one rule
But i want to say in another ide/editor output is 0 but in turbo c its 1
Artium
But i want to say in another ide/editor output is 0 but in turbo c its 1
The printf inside the loop is not supposed to run at all so I suspect that the 0/1 you see is something else. Try replacing the printf with printf("abc");
Artium
What other editor did you try? The clrscr is available only in turbo compiler
Anonymous
Anonymous
You have 0 in part that should have some condition
and in condition if we replace 0 by 1 than it will be an infinite loop
Nikolas
of course, because 1 evaluates to true every time
Nikolas
you need a condition that changes at some point
Anonymous
of course, because 1 evaluates to true every time
but than i replace 1 to 0 than why i got 1 in output
Nikolas
Nikolas
You should not get 1, probably is something else
Nikolas
maybe the exit code of the program?
Anonymous
Nikolas
try to put like printf("abdc%d", a);
Nikolas
see if you stil lget 1 or "abcd1"
Anonymous
if u r on system than run this program
Anonymous
and tell me what u got in output
Nikolas
no
Nikolas
I can tell you what the output would be
Nikolas
because it's a simple program
Nikolas
we are trying to help you but you won't listen
Anonymous
but sir u r wrong
Nikolas
also, you can use a lot of online compilers
Nikolas
but sir u r wrong
¯\_(ツ)_/¯
Anonymous
also, you can use a lot of online compilers
yeah when i run this program on code block than i get diffrent output and on turbo c++ i get diffrent
Nikolas
then don't use Turbo C++
Nikolas
which is an outdated ide
Nikolas
it hasn't been updated in almost 13 years
Anonymous
ok, Thanks for Suggestion
BinaryByter
I'm such a moron 😂
BinaryByter
it just took me a fill 3 minutes to find that I missed an opening brace
BinaryByter
though the error messages didn't make it easy on me
BinaryByter
😂
BinaryByter
This is what we call "missing opening brace" in C++: clang++ -std=c++17 src/threadweaver.hpp src/threadweaver.hpp:96:57: error: member initializer 'threads' does not name a non-static data member or base class ThreadScheduler(unsigned int amountOfThreads = 1) : threads(amountOfThreads, Thread{}) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ src/threadweaver.hpp:101:24: error: use of undeclared identifier 'threads'; did you mean 'fread'? for (auto &i : threads) ^~~~~~~ fread /usr/include/stdio.h:646:15: note: 'fread' declared here extern size_t fread (void *__restrict __ptr, size_t __size, ^ src/threadweaver.hpp:101:22: error: invalid range expression of type 'unsigned long (void *, unsigned long, unsigned long, _IO_FILE *)'; no viable 'begin' function available for (auto &i : threads) ^ ~~~~~~~ src/threadweaver.hpp:106:24: error: use of undeclared identifier 'threads'; did you mean 'fread'? for (auto &i : threads) ^~~~~~~ fread /usr/include/stdio.h:646:15: note: 'fread' declared here extern size_t fread (void *__restrict __ptr, size_t __size, ^ src/threadweaver.hpp:106:22: error: invalid range expression of type 'unsigned long (void *, unsigned long, unsigned long, _IO_FILE *)'; no viable 'begin' function available for (auto &i : threads) ^ ~~~~~~~ src/threadweaver.hpp:112:9: error: unknown type name 'threads'; did you mean 'Thread'? threads[dispatcher % size()].queueFunction(function, arguments...); ^~~~~~~ Thread src/threadweaver.hpp:58:8: note: 'Thread' declared here struct Thread ^ src/threadweaver.hpp:112:17: error: use of undeclared identifier 'dispatcher' threads[dispatcher % size()].queueFunction(function, arguments...); ^ src/threadweaver.hpp:112:37: error: cannot use dot operator on a type threads[dispatcher % size()].queueFunction(function, arguments...); ^ src/threadweaver.hpp:113:9: error: use of undeclared identifier 'dispatcher' dispatcher++; ^ src/threadweaver.hpp:117:16: error: use of undeclared identifier 'threads' return threads.size(); ^ src/threadweaver.hpp:121:23: error: use of undeclared identifier 'threads' if (newSize > threads.size()) ^ src/threadweaver.hpp:122:24: error: use of undeclared identifier 'threads' addThreads(threads.size() - newSize); ^ src/threadweaver.hpp:124:27: error: use of undeclared identifier 'threads' removeThreads(threads.size() - newSize); ^ src/threadweaver.hpp:134:13: error: use of undeclared identifier 'threads' threads.push_back (Thread{}); ^ src/threadweaver.hpp:141:9: error: expected statement } ^ src/threadweaver.hpp:142:6: error: expected ';' after struct } ^ src/threadweaver.hpp:147:1: error: extraneous closing brace ('}') } // namespace THW
Luis José
This is what we call "missing opening brace" in C++: clang++ -std=c++17 src/threadweaver.hpp src/threadweaver.hpp:96:57: error: member initializer 'threads' does not name a non-static data member or base class ThreadScheduler(unsigned int amountOfThreads = 1) : threads(amountOfThreads, Thread{}) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ src/threadweaver.hpp:101:24: error: use of undeclared identifier 'threads'; did you mean 'fread'? for (auto &i : threads) ^~~~~~~ fread /usr/include/stdio.h:646:15: note: 'fread' declared here extern size_t fread (void *__restrict __ptr, size_t __size, ^ src/threadweaver.hpp:101:22: error: invalid range expression of type 'unsigned long (void *, unsigned long, unsigned long, _IO_FILE *)'; no viable 'begin' function available for (auto &i : threads) ^ ~~~~~~~ src/threadweaver.hpp:106:24: error: use of undeclared identifier 'threads'; did you mean 'fread'? for (auto &i : threads) ^~~~~~~ fread /usr/include/stdio.h:646:15: note: 'fread' declared here extern size_t fread (void *__restrict __ptr, size_t __size, ^ src/threadweaver.hpp:106:22: error: invalid range expression of type 'unsigned long (void *, unsigned long, unsigned long, _IO_FILE *)'; no viable 'begin' function available for (auto &i : threads) ^ ~~~~~~~ src/threadweaver.hpp:112:9: error: unknown type name 'threads'; did you mean 'Thread'? threads[dispatcher % size()].queueFunction(function, arguments...); ^~~~~~~ Thread src/threadweaver.hpp:58:8: note: 'Thread' declared here struct Thread ^ src/threadweaver.hpp:112:17: error: use of undeclared identifier 'dispatcher' threads[dispatcher % size()].queueFunction(function, arguments...); ^ src/threadweaver.hpp:112:37: error: cannot use dot operator on a type threads[dispatcher % size()].queueFunction(function, arguments...); ^ src/threadweaver.hpp:113:9: error: use of undeclared identifier 'dispatcher' dispatcher++; ^ src/threadweaver.hpp:117:16: error: use of undeclared identifier 'threads' return threads.size(); ^ src/threadweaver.hpp:121:23: error: use of undeclared identifier 'threads' if (newSize > threads.size()) ^ src/threadweaver.hpp:122:24: error: use of undeclared identifier 'threads' addThreads(threads.size() - newSize); ^ src/threadweaver.hpp:124:27: error: use of undeclared identifier 'threads' removeThreads(threads.size() - newSize); ^ src/threadweaver.hpp:134:13: error: use of undeclared identifier 'threads' threads.push_back (Thread{}); ^ src/threadweaver.hpp:141:9: error: expected statement } ^ src/threadweaver.hpp:142:6: error: expected ';' after struct } ^ src/threadweaver.hpp:147:1: error: extraneous closing brace ('}') } // namespace THW
LOOOL
BinaryByter
xD
Mihail
This is what we call "missing opening brace" in C++: clang++ -std=c++17 src/threadweaver.hpp src/threadweaver.hpp:96:57: error: member initializer 'threads' does not name a non-static data member or base class ThreadScheduler(unsigned int amountOfThreads = 1) : threads(amountOfThreads, Thread{}) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ src/threadweaver.hpp:101:24: error: use of undeclared identifier 'threads'; did you mean 'fread'? for (auto &i : threads) ^~~~~~~ fread /usr/include/stdio.h:646:15: note: 'fread' declared here extern size_t fread (void *__restrict __ptr, size_t __size, ^ src/threadweaver.hpp:101:22: error: invalid range expression of type 'unsigned long (void *, unsigned long, unsigned long, _IO_FILE *)'; no viable 'begin' function available for (auto &i : threads) ^ ~~~~~~~ src/threadweaver.hpp:106:24: error: use of undeclared identifier 'threads'; did you mean 'fread'? for (auto &i : threads) ^~~~~~~ fread /usr/include/stdio.h:646:15: note: 'fread' declared here extern size_t fread (void *__restrict __ptr, size_t __size, ^ src/threadweaver.hpp:106:22: error: invalid range expression of type 'unsigned long (void *, unsigned long, unsigned long, _IO_FILE *)'; no viable 'begin' function available for (auto &i : threads) ^ ~~~~~~~ src/threadweaver.hpp:112:9: error: unknown type name 'threads'; did you mean 'Thread'? threads[dispatcher % size()].queueFunction(function, arguments...); ^~~~~~~ Thread src/threadweaver.hpp:58:8: note: 'Thread' declared here struct Thread ^ src/threadweaver.hpp:112:17: error: use of undeclared identifier 'dispatcher' threads[dispatcher % size()].queueFunction(function, arguments...); ^ src/threadweaver.hpp:112:37: error: cannot use dot operator on a type threads[dispatcher % size()].queueFunction(function, arguments...); ^ src/threadweaver.hpp:113:9: error: use of undeclared identifier 'dispatcher' dispatcher++; ^ src/threadweaver.hpp:117:16: error: use of undeclared identifier 'threads' return threads.size(); ^ src/threadweaver.hpp:121:23: error: use of undeclared identifier 'threads' if (newSize > threads.size()) ^ src/threadweaver.hpp:122:24: error: use of undeclared identifier 'threads' addThreads(threads.size() - newSize); ^ src/threadweaver.hpp:124:27: error: use of undeclared identifier 'threads' removeThreads(threads.size() - newSize); ^ src/threadweaver.hpp:134:13: error: use of undeclared identifier 'threads' threads.push_back (Thread{}); ^ src/threadweaver.hpp:141:9: error: expected statement } ^ src/threadweaver.hpp:142:6: error: expected ';' after struct } ^ src/threadweaver.hpp:147:1: error: extraneous closing brace ('}') } // namespace THW
If only you looked at the last line first
BinaryByter
nobody should do that 😂
BinaryByter
because normally the last lines of errors make no sense
BinaryByter
because they follow from the first error
🐰🐾 سمیه
Hi, who has K&R book? I have a question from that.
BinaryByter
Also stop reading antique bookx
🐰🐾 سمیه
just ask
It's long, one should have it and take a look.
BinaryByter
no, ask us
BinaryByter
I don't read old books
🐰🐾 سمیه
I don't read old books
In persian we say: smoke rises from the old logs. ( new logs are wet and so they aren't burnable) Meaning sometimes old ones or persons are better because of their experiences.
BinaryByter
No
BinaryByter
K&R is an old book which knowledge is better covered in newer books
🐰🐾 سمیه
K&R is an old book which knowledge is better covered in newer books
I'm at page 110, can't leave it now 😐
BinaryByter
you can read it
BinaryByter
But you will have to unlearn a lot to become a good programmer
🐰🐾 سمیه
😂
BinaryByter
anyway, ask us your question
🐰🐾 سمیه
May be 😔
🐰🐾 سمیه
Ok, let me take a screen shot
BinaryByter
Okay
🐰🐾 سمیه
main()
BinaryByter
K&R c allowed for function definitions that have no return type, I think
🐰🐾 سمیه
why there is ( left + right) / 2 in swap here?
🐰🐾 سمیه
K&R c allowed for function definitions that have no return type, I think
you mean type void? yes they are just used just for their effect.