labyrinth
i cant understand that BAIDU_CACHELINE_ALIGNMENT is used for
labyrinth
ahh found it, i didnt expect it to be attribute, which is extensively used in memory alignment for struct i suppose ?
Anonymous
/warn @abhiVerma200 pming
Anonymous
Have a aaray of type struct Node *A with malloc
Anonymous
/get ide
Anonymous
/get ide
Anonymous
well this https://codecondo.com/top-10-ide-for-c-and-cplusplus-for-programmers/ is kinda more appropriate, don't you think?
Vlad
So I really don't think so
Anonymous
Anonymous
ok how about this https://www.slant.co/topics/10211/~c-ides
Asad
Let's run this sort of survey in this group. Shall I create and send the poll?
Aman
https://pastebin.com/LehfcJH9
Aman
getting this output for above program
Aman
No of duplicates is 1061758308
Aman
why I am getting this random no output if possible then tell me because i am new to c.
Pavel
why I am getting this random no output if possible then tell me because i am new to c.
Honestly I don't remember printf signature. Does it accept pointers as its arguments? Shouldn't it be just count not &count?
Aman
@dkuch_idr your soution works btw
Aman
thank u for that
Igor🇺🇦
https://pastebin.com/LehfcJH9
In addition to using &count instead of count, your comparison is wrong.
shayan
Hi,can anyone introduce a java and python programming group?
Henry
Hi please i am really stuck choosing the most useful btw Let us C and C modern approach, I have read the /get post but i need your opinion please
Henry
Please It draining my focus
Jas
Please It draining my focus
Your question does not make sense. Rephrase it and try again. However if you’re already losing patience C/C++ might not be for you.
Anonymous
If I am a asking about book why u are giving me a warning
Jas
It’s in the rules.
Georges
Hello, i want to ask how can i create a struct in c++ that is not copyable.
Pavel
Hello, i want to ask how can i create a struct in c++ that is not copyable.
You can delete copy constructor and copy assignment operator to do that struct Foo{ Foo(const Foo&) = delete; Foo& operator=(const Foo&) = delete; };
Pavel
To follow "the rule of 5" you can also delete the move constructor and move assignment operator, and = default the destructor
Georges
Oh okayy Thank you my friend
Promise
Pls WhatsApp link for SQL
Roxifλsz 🇱🇹
Pls WhatsApp link for SQL
/ban single digit IQ
Aman
@JRandomGuy I now understood my mistake .Btw thanks for caring about me.
Eliud
/get ide
PO
hi
PO
I would like to use fget() in function
PO
but i dont know what is the type of return of fget()?
PO
Where did you look?
google, I want just do some things like that if (getc() != char){ constinue ; } else{ go next line with fscanf(); }
shayan
@en_it_chats
Thanks🙏🙏🙏
AHMED
#include<iostream> #include<any> #include<string> using namespace std; int main(){ any a = 5; any b = 8.9; any c = false; any d ='v'; any e = "You are doing a great job. I am proud of you."; cout<<any_cast<int>(a)<<endl; cout<<any_cast<double>(b)<<endl; cout<<any_cast<bool>(c)<<endl; cout<<any_cast<char>(d)<<endl; cout<<any_cast<string>(e)<<endl; return 0; }
AHMED
5 8.9 0 v terminating with uncaught exception of type std::bad_any_cast: bad any cast Aborted [Program finished]
AHMED
How to safely access string using any container?
Pavel
How to safely access string using any container?
That was const char* probably, you probably need to create string explicitly any e = string("some text");
Vlad
Or create a temporary string as Pavel suggested
AHMED
I wrote this code....and it worked. Thanks again
AHMED
#include<iostream> #include<any> #include<string> using namespace std; int main(){ any b = string("u r awesome"); any c = "hello again"; cout<<any_cast<string>(b)<<endl; cout<<any_cast<const char*>(c)<<endl; return 0; }
PO
#Comment P1 6 10 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 1 0 0 0 1 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 static void detector(FILE *opf){ assert(opf != NULL); char firstCharacter = getc(opf); printf("--------------%c\n", firstCharacter); if(firstCharacter == '#'){ fscanf(opf,"%*[^\n]"); printf("Comment line detected\n"); }else{ printf("Comment linet not detected \n"); fseek(opf, 1, SEEK_SET); fprintf(opf,"%c",firstCharacter); } } Why gtc() and fgetc(), change the P1 to P0?
PO
🙏🏻 please
PO
I think that's fprintf, not getc that changes values.
I think I have to use fgetc() not gtc() because I want read the first char from a file
Igor🇺🇦
okay just give a min to try
I have no idea what your program is supposed to do though. So don't know what's expected behaviour
Igor🇺🇦
I think I have to use fgetc() not gtc() because I want read the first char from a file
These methods don't modify files. They only read them.
PO
MY FILE IS P1 6 10 0 0 0 0 1 0 #Comment 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 1 0 0 0 1 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 I have to find the comment line which begin with # and ignore them them while or before scanning or remove them and then rewrite it into new file
Igor🇺🇦
I think it will be simpler
PO
I think it will be simpler
let me try but I don't know the size of comment line
Igor🇺🇦
let me try but I don't know the size of comment line
Doesn't matter. You need only the first character to know that you're reading the comment. I assume comment ends with new line.
PO
Doesn't matter. You need only the first character to know that you're reading the comment. I assume comment ends with new line.
You mean some thing like that? static void check_line(FILE *opf){ char buffer[1000]; if( (strcmp ( fgets (buffer , 0, opf) , "#") ) ){ fscanf(opf,"\n"); }else{ return 0; } }
⚛ Hz
You could build a simple state machine
⚛ Hz
It "peek" the first character to decide the next state (comment or useful data)
⚛ Hz
Assume there only two type of line