pavel
It's just alias
Alireza
No difference
oh ok tnx
Leovan
Anyone know how to debug executable which compiled by msvc (Microsoft compiler) using gdb? Msvc store debugging symbols in sepatare .pdb file only and gdb can't parse them.
习近平我肏你妈
I don't think gcc can recognize debug symbols made by msvc. Gcc is not responsible for doing so.
Michael
Ok
Pablo
Guys
Pablo
Have you ever used the gstreamer library?
Anonymous
does any one know certification program for c ? instructor led? paid?
Buffer
#include<stdio.h> int main(int argc, char *argv[]) { int j=0,i=0,count=6; switch(3) { case 0: while(--count>0) { case 1: ++j; case 2: ++i; case 3: ; case 4: ; case 5: ; } } printf("%d\t %d",i,j); return 0; }
Buffer
Help me!
Jerry
Why it prints 5 5 instead of 0 0
insert break after case1 to 5
HIRO
Pavel
#include<stdio.h> int main(int argc, char *argv[]) { int j=0,i=0,count=6; switch(3) { case 0: while(--count>0) { case 1: ++j; case 2: ++i; case 3: ; case 4: ; case 5: ; } } printf("%d\t %d",i,j); return 0; }
Oh my, this is cursed :) case doesn't create scope (it is just goto under the hood), so it seems that this somehow jumps into the middle of the loop https://wandbox.org/permlink/SK6ELJZG7pHthpRj
Anonymous
Does anyone suggest me good Data structures course in c++
Alireza
HMODULE GCM() { HMODULE hModule = NULL; GetModuleHandleEx( GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, LPCTSTR(GCM), &hModule); return hModule; }
Faramarz
treeNameNode* DeleteName(treeNameNode* root, char data[]) { if (root == NULL) { return NULL; } if (strcmp(data, root->treeName) < 0) { // data is in the left sub tree. root->left = DeleteName(root->left, data); } else if (strcmp(data, root->treeName) > 0) { // data is in the right sub tree. root->right = DeleteName(root->right, data); } else { // case 1: no children if (root->left == NULL && root->right == NULL) { free(root); // wipe out the memory, in C, use free function root = NULL; } // case 2: one child (right) else if (root->left == NULL) { treeNameNode* temp = root; // save current node as a backup root = root->right; free(temp);//delete } // case 3: one child (left) else if (root->right == NULL) { treeNameNode* temp = root; // save current node as a backup root = root->left; free(temp); } // case 4: two children else { treeNameNode* temp = minValName(root->right); // find minimal value of right sub tree strcpy(root->treeName, temp->treeName); // duplicate the node //root->count = temp->count; root->right = DeleteName(root->right, temp->treeName); // delete the duplicate node } } return root; // parent node can update reference } void freeAll(treeNameNode* root) { if(root == NULL) return; freeAll(root->left); freeAll(root->right); free(root); }
Faramarz
treeNameNode* DeleteName(treeNameNode* root, char data[]) { if (root == NULL) { return NULL; } if (strcmp(data, root->treeName) < 0) { // data is in the left sub tree. root->left = DeleteName(root->left, data); } else if (strcmp(data, root->treeName) > 0) { // data is in the right sub tree. root->right = DeleteName(root->right, data); } else { // case 1: no children if (root->left == NULL && root->right == NULL) { free(root); // wipe out the memory, in C, use free function root = NULL; } // case 2: one child (right) else if (root->left == NULL) { treeNameNode* temp = root; // save current node as a backup root = root->right; free(temp);//delete } // case 3: one child (left) else if (root->right == NULL) { treeNameNode* temp = root; // save current node as a backup root = root->left; free(temp); } // case 4: two children else { treeNameNode* temp = minValName(root->right); // find minimal value of right sub tree strcpy(root->treeName, temp->treeName); // duplicate the node //root->count = temp->count; root->right = DeleteName(root->right, temp->treeName); // delete the duplicate node } } return root; // parent node can update reference } void freeAll(treeNameNode* root) { if(root == NULL) return; freeAll(root->left); freeAll(root->right); free(root); }
Hi everyone, I have two function for binary search tree that one of them is supposed to delete one node from the tree and another one is supposed to free up the memory. When ever I use deleting function and the freeAll function I get a warning for double free, could you help me to solve this issue?
B;
How am I supposed to send my code here . It keeps getting deleted
B;
It says it contains external links
B;
// dynamic constructor #include <stdio.h> #include <conio.h> #include <iostream> using namespace std; class dynamic const { char *name; int size; public: dynamic const() { name = NULL; size = 0; } dynamic const(char *s) { size = strlen(s); name = new char(size) + 1; strcpy = (name, s); } void showdata() { cout << "name = " << name; cout << "size =" << size; } dynamic concat(dynamic const s2) { dynamic const temp; temp.size = size + s2.size; temp . name + new char(temp.size) + 1; strcpy(temp . name); strcat(temp . name, s2 . name); return (temp); } }; void main() { dynamic const s1("axxxan"); dynamic const s2("computer"); dynamic const s3(); s1.showdata(); s2.showdata(); s3 = s1.concat(s2); cout << "the concated objs are: "; s3.showdata(); getch(); }
B;
Error: expected unqualified id before '{' token.
Saro
How am I supposed to send my code here . It keeps getting deleted
you can wrap your code inside “```" “```" symbols
B;
7:1
Saro
cosnt have to be before class keyword
Saro
Sorry?
Instead of “class dynamic const” you should write “const dynamic class“
Ster-Devs
cosnt have to be before class keyword
Please, what is the use of const keyword when we declare a class in C++ ?
Ludovic 'Archivist'
Please, what is the use of const keyword when we declare a class in C++ ?
Const attributes can no longer be changed after initialization Const methods can't modify any attributes from the class
Ludovic 'Archivist'
Only const methods can be called with a const reference to the object
Ludovic 'Archivist'
Const enables reordering based optimizations
Saro
Instead of “class dynamic const” you should write “const dynamic class“
This is also wrong const keyword shouldn’t be there
B;
https://pastebin.com/cqYKzS83 Check this one
Ster-Devs
Joaquin
I am looking for a software to evaluate the metrics of my programs, does anyone know any?
Shutz
Hello
Dima
Hello
what is difference between a reference and pointer?
Shutz
Am here to learn bro
Shutz
😁
Saro
what is difference between a reference and pointer?
pointer is an variable which contains reference
Dima
bruh I was just checking if it isn’t a spambot
Pablo
$ gcc $(pkg-config --cflags gtk+-3.0) -o hello-world-gtk hello-world-gtk.c $(pkg-config --libs gtk+-3.0) hello-world-gtk.c: In function 'activate': hello-world-gtk.c:23:3: warning: implicit declaration of function 'gtk_window_set_child'; did you mean 'gtk_window_set_role'? [-Wimplicit-function-declaration] 23 | gtk_window_set_child (GTK_WINDOW (window), button); | ^~~~~~~~~~~~~~~~~~~~ | gtk_window_set_role D:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/12.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: D:\msys64\tmp\ccRFxdbn.o:hello-world-gt:(.text+0xf6): undefined reference to `gtk_window_set_child' collect2.exe: error: ld returned 1 exit status
Pablo
what am I doing wrong?
Pablo
I'm trying to compile a simple gtk program
Евгений
I'm trying to compile a simple gtk program
Don't use garbage. Use qt and everything will be okay.
Pablo
I think
pavel
What century now? Why we still using gtk?
Daulet
What century now? Why we still using gtk?
gtk is not ancient, but on windows looks not native.
Daulet
What century now? Why we still using gtk?
Кст чел будет правильно still вроде?
pavel
I don't see a reasons to use gtk when qt available
Alireza
who knows about aspose word cpp?
Евгений
:V but it doesn't work with C
It works with C++, and only C++. It also supports garbage python but with python it still work badly, because it's python.
Pablo
I don't see a reasons to use gtk when qt available
I need to use C because it's the language the professor is using in college
Pablo
alright
Pablo
:(
pavel
Starting new projects on C is a crime
pavel
Problem is people use what they know. After education students will famous with C, so much probably will use in work and software what they will develop will suffer from C problems
pavel
We already have tons of legacy code, and community should move forward
Pavel
I don't think someone will allow junior devs to write something in the language they want (can be, but unlikely), the problem is mostly when people write C++ code as if it's C. So you there's a need to unlearn some C stuff later if going to C++. However today one can go to Rust from C instead.
Pablo
I managed to fix the bug
Pablo
hey
Daulet
Good
Pablo
my program only works when it's in the same directory of the dll files it needs
Daulet
my program only works when it's in the same directory of the dll files it needs
If you want one binary file(.exe) then use static linking
Pablo
If you want one binary file(.exe) then use static linking
but if I use dynamic linking then my .exe has to be in the same dir as the dlls? Or can I change it?
Pablo
Yes. But you can change it
I would have to change things inside the dlls?
Daulet
I would have to change things inside the dlls?
No that can be changed in compiler options or in build system(makefile, cmake)