[Solved] C++ add pointers to structure

Very simply, create a class that has Uczestnik as a member variable. struct UczestnikList { UczestnikList *next; UczestnikList *prev; Uczestnik val; // or Uczestnik* val; }; Now you can use the UczestnikList and traverse through it. Also note that val could be an embedded member variable or a pointer (Uczestnik* val) depending on how you … Read more

[Solved] Need help i get segmentation fault in program in C

A proper implementation of getfiles (gets all the files in a directory in a dynamic array) and provides a deallocator: #include <stdio.h> #include <dirent.h> #include <string.h> #include <stdlib.h> /* returns a NULL terminated array of files in directory */ char **getfilelist(const char *dirname) { DIR *dp; char **entries = NULL; struct dirent *entry; off_t index … Read more

[Solved] Pattern by means of function

We, beginners, should help each other.:) Here you are. The code is written in C++. So you need to investigate it and rewrite it in C yourself. #include <iostream> int main() { while ( true ) { std::cout << “Input the number of elements : “; unsigned int n; if ( not ( std::cin >> … Read more

[Solved] How would I approach sorting something like this

Here is how you would do that without using a Treeview (why wouldn’t you I don’t know): void Main() { string values = @”1 14 141 141010 141020 141030 141040 141050 141060 142 142010 142020 144 1440 144010 144020 144030 144040 145020 145030 145010 “; int myValue; // Splitting and converting to a collection of … Read more

[Solved] Why doesn’t the char convert to an int?

There are three things confusing you here. First the expressions: i1 = data[0]; i2 = data[p1]; Assign the character values of data[0] and data[p1] If the input is 2+4 you’re actually assigning the character values of ‘2’ and ‘+’. In ASCII “2” is represented by code-point 50 and “+” by 43. So then the expression … Read more

[Solved] Launch all URLs in webbrowser c# 2 seconds to 2 seconds

I think you are overwriting your websites-object in every loop with the following line: websites = new List<string> {“https://mbasic.facebook.com/groups/”+groups[i]}.GetEnumerator(); That’s why it only prints the last website. Have a look at How can I add an item to a IEnumerable collection? Furthermore this could help you, too: IEnumerable vs. IEnumerator and implementation 9 solved Launch … Read more

[Solved] Read a file using argv

You can run the program as: IFS=$’\n’ ./sort.exe $(cat file.txt) Each line of the file will then be an argument to the program (setting IFS to just newline prevents spaces in the file from being argument delimiters). Then the program can loop over argv (except for argv[0], which contains the program name) to get all … Read more

[Solved] Why is it not good practice to use ‘goto’? [duplicate]

Introduction The use of the ‘goto’ statement in programming has been a controversial topic for many years. While it can be used to simplify certain types of programming tasks, it is generally considered to be bad practice and should be avoided. In this article, we will discuss why it is not good practice to use … Read more