Anonymous
Try this: http://www.xmlsoft.org/examples/
@shreeprasathmscss Someone did give you this site and you replied to this message as well. Aren't the examples in that site in C?
Anonymous
we don't have a solution in that.. i tired
What do you mean by you don't have a solution? The examples listed clearly show how to parse an XML file with XMLReader, creating a tree from an XML file, navigating the tree, evaluating XPath expressions etc etc. What more do you want?
Anonymous
Hello here
Anonymous
I'm trying to install a program on windows 10 but keep getting "segmentation fault" error who can help me please?
klimi
I'm looking for how to read XML file in c programming language
Its kinda not that hard. Either use some library or if you want, you can write parser for it. This task is given to first year students in computer science so I bet you can figure it out
klimi
Don't you think this is a spam?
Kriss
`` 🇫🇷 ;; ce serai ta blonde ce soir, si c'est ce que tu aimes
Hey, can I send my hash map implementation in c to this chat for rating?
Anonymous
Kindly I'm new to C++ and I've finished learning data structure and algorithm and oop in C++ what topic should I cover next kindly?
Pavel
Hey, can I send my hash map implementation in c to this chat for rating?
You can try but usually people don't review big classes (also avoid sending long code snippets directly to the chat, use code pasting services like pastebin if you need to). You can also try you luck here https://codereview.stackexchange.com/
Manuel
L'amour, la mort... tout un programme haha
Pavel
Thanks!
Here's your link deleted by the bot https://yaso.su/5DDlVzfC
`` 🇫🇷 ;; ce serai ta blonde ce soir, si c'est ce que tu aimes
Manuel
Looks pretty clean to me at first sight
Manuel
Links are forbidden here? Couldn't find it in the rules
Manuel
You haven't freed your calloc @mdntlzokfsmg ?
`` 🇫🇷 ;; ce serai ta blonde ce soir, si c'est ce que tu aimes
Manuel
L94
`` 🇫🇷 ;; ce serai ta blonde ce soir, si c'est ce que tu aimes
I don't check NULL on calloc, but I freed memory with deleteHashMap
`` 🇫🇷 ;; ce serai ta blonde ce soir, si c'est ce que tu aimes
L75
Pavel
Links are forbidden here? Couldn't find it in the rules
The links from new users (less than a day in the chat) removed automatically
Manuel
I don't check NULL on calloc, but I freed memory with deleteHashMap
I see... ok, then this function should always be called at the end, otherwise valgrind will scream ;)
`` 🇫🇷 ;; ce serai ta blonde ce soir, si c'est ce que tu aimes
Yep, L33 cleans all memory
/
What is crosscall2 for?
Anonymous
#include <iostream> #include <string> int main(){ std::string name,email,pwd,pwd2; int age,birthday; std::string profile[] = {name,email,pwd,pwd2}; std::cout<<"hello sir welcome to our program"<<std::endl; std::cout<<"what is your name sir"<<std::endl; std::cin<<name<<std::endl; std::cout<<"what is your email sir"<<std::endl; std::cin<<email<<std::endl; std::cout<<"what is your password sir"<<std::endl; std::cin<<pwd<<std::endl; std::cout<<"what is your confirm your password sir"<<std::endl; std::cin<<pwd2<<std::endl; std::cout<<profile<<std::endl; return 0; }
Anonymous
why it doesn't work
Anonymous
i didn't understand the error
Anonymous
c++\test.cpp|12|error: no match for 'operator<<' (operand types are 'std::istream {aka std::basic_istream<char>}' and 'std::__cxx11::string {aka std::__cxx11::basic_string<char>}')|
Anonymous
i didn't understand the error
Try writing a simple input output program first. Like input an integer and print it.
Anonymous
i did
Anonymous
i did
Show that
Anonymous
1sec
Forest
Its cin>>variable;
Leteipa
#include<stdio.h> void main() { int matrix1[10][10],i,j,m,n; printf("enter the row and column of matrix1"); scanf("%d%d",&m,&n); for(i=0;i<m;i++) { for(j=0;j<n;j++) { scanf("%d",&matrix1[i][j]); } } for(i=0;i<m;i++) { for(j=0;j<n;j++) { printf("%d\t",matrix1[i][j]); } printf("\n"); } }
Anonymous
Hey, can I send my hash map implementation in c to this chat for rating?
Your hashmap implementation idea seems ok. The problems are 1) When two keys hash to the same value, you overwrite the previous value. Ideally, you should do something like a probe to determine the next free slot where it can be inserted. With your current implementation, I can use a non existent key that hashes to the same value that an existing key hashes to and retrieve that value. So during retrieval, you should compare the keys 2) A more serious problem is that when you overwrite a key, you don't check to see if the new key is greater in size than the old key and call strcpy blindly. This would result in Undefined Behavior. Use strncpy after allocating the correct memory.
Richard Luo 🐱
class B { public: int b = 10; B() { }; ~B() { cout<<"b destruct"<<endl; } }; class A { public: const B& b; A(B&& b) : b(b) { } ~A() { cout<<"a destruct"<<endl; } }; A* a; void create() { a = new A(B()); } int main() { create(); cout<<a->b.b<< endl; delete a; return 0; }
Richard Luo 🐱
The result is b destruct 10 a destruct
Richard Luo 🐱
I am confused... if b is destructed, why b is still accessible in the following line???
Pavel
I am confused... if b is destructed, why b is still accessible in the following line???
Member b in your a instance become a dangling reference, meaning a reference that points to the memory that used to belong to an object. In your case the memory probably still contains 10, but accessing anything through a dangling reference is UB and this code can result in anything.
Aleksandr
file needs to be open twice in wt mode to be created and in rt mode to make copy of file. Why i can't copy file with wt mode?
Null
Is there a c program to find the maximum and minimum points of a curve using calculus
Vez_Man
Please what's the difference between C, C# and C++
labyrinth
I encountered a case that I don't understand: 1. pushing 100k elements to a priority queue takes 79ms 2. popping 100k elements from the same priority queue takes 500ms what is causing such performance difference ?
Anonymous
I encountered a case that I don't understand: 1. pushing 100k elements to a priority queue takes 79ms 2. popping 100k elements from the same priority queue takes 500ms what is causing such performance difference ?
Though both push and pop are O(lg n), the O notation hides the constant factor. Popping does more work than pushing. While popping, you copy the last element in the heap to the root i.e. the first element in the underlying vector and then sift it down. While sifting it down, you compare it with both it's children. For pushing you use a sift up operation where you just compare it with one element (its parent). So popping is atleast 2 times slower than pushing. Perhaps your particular implementation adds additional costs. On my implementation, pushing 100k elements takes 32 ms and popping takes 121 ms
labyrinth
thanks a lot!
Anonymous
fair enough, your implementation differ from the theoretical performance difference as well
When I said implementation, I meant your compiler's standard library implementation. It is not always just a 2 factor. There could be additional costs like for ex: the comparator in your case or some internal mechanism in your library itself. The standard says that it is expected for pop to do 2 times more comparisons than push. So the 2 is already implicit. There could be additional costs depending on factors outside of your control. If you find this cost unsatisfactory, perhaps you should use a different data structure.
Anonymous
Gys I installed vs code but mingw-64 compiler is not download in chrome plzz send me link for mingw-64 compiler
mito
Gys I installed vs code but mingw-64 compiler is not download in chrome plzz send me link for mingw-64 compiler
Did you search "how to install mingw64 compiler on windows" in youtube ?
Strife
What do you think about carbon language?
Anonymous
What do you think about carbon language?
Might get flop We already have so much language Some getting vanished
Anonymous
#Puzzle #include <deque> #include <memory> #include <vector> struct A { // (a) removing the following line - code compiles std::deque<int> d; // (b) removing the following line - code compiles std::vector<std::unique_ptr<int>> v; // (c) adding the following line - code compiles //A(A&&) = default; // note: even without 'noexcept' // (d) adding the following line - code compiles // std::unique_ptr<int> p; A() = default; }; int main() { std::vector<A> v; // (e) removing the following line - code compiles v.emplace_back(); } The code above fails to compile. It would compile if you follow any one of the 5 instructions marked a,b,c,d and e. Why?
/
static void _swig_gopanic(const char *p) { struct { const char *p; } SWIGSTRUCTPACKED a; a.p = p; crosscall2(_cgo_panic, &a, (int) sizeof a); }
/
And what is crosscall2
Daulet
And what is crosscall2
Maybe that function calls panic() in Go
/
Maybe that function calls panic() in Go
But why there isn't documentation about that function
Daulet
But why there isn't documentation about that function
https://go.dev/src/runtime/cgocall.go 38 line check comments, I didn't find docs
Daulet
But I didn't understanded well what it does
Calling function by pointer. _cgo_panic is pointer to function other arguments is passes to function
/
Calling function by pointer. _cgo_panic is pointer to function other arguments is passes to function
So the first argument is a pointer to the function and the other are the parameters?
Daulet
But I didn't understanded well what it does
void crosscall2(void (*fn)(void *), void *, int);
Daulet
In your case you passes error message in arguments