[Solved] Segmentation fault occurs in C program

[ad_1] As sjsam pointed out, this statement is wrong: arr=(int **) malloc(sizeof(int )*n); Your program works on systems where sizeof(int) == sizeof(int*) (i.e. 32-bit systems), but will likely fail on 64-bit ones (on which sizeof(int) == 4 and sizeof(int*) == 8. i want to create a 2d array dynamically of dimension n by q We … Read more

[Solved] Why can’t I play an MP3 file from a separate object?

[ad_1] The code you are writing in the Offnen.cs file isn’t doing anything with the file because the variable “mp” is local to the object o (Offnen). Perhaps something like this is what you are looking for: MainWindow.xaml.cs #region Öffnen der Datei private void menuOffnen_Click(object sender, RoutedEventArgs e) { mp.Pause(); Offnen o = new Offnen(); … Read more

[Solved] c++ use template class [closed]

[ad_1] Is there any way to compile this code such as inheritance, overload…? No. Not as you are trying to at least. mylist *y = new mylist(); //….how? isn’t valid since you have to provide a template parameter for mylist like mylist<MyType>. You’re probably looking for template specializations. 6 [ad_2] solved c++ use template class … Read more

[Solved] Length of string in String.Format()

[ad_1] That is so totally not a string.format issue that it is not funny. Please consider doing a little basic debugging yourself. Values (abc,efd,gr,y,t,ui,u,re,re This is not valid SQL. See, string values have to be in paranthesis of some sort (‘abc’ instad of abc). Simply speaking your (btw, the old string.format syntax is hard to … Read more

[Solved] inner product function in C [closed]

[ad_1] You have so many errors in your code. First, you are not defining your arrays as arrays, but as single int values. You should define them correctly: int *a, *b; Second, you are not allocating your arrays. If you want to create them on runtime you will have to use malloc() after you get … Read more

[Solved] C++ template specialization

[ad_1] So what I was missing was <int, int>. complete code: template <typename typeA, typename typeB> typeA foo(const typeB *pt) { // do something; } template float foo<float, float>(const float *pt); template double foo<double, double>(const double *pt); template<> int foo<int, int>(const int *pt) { // do something different for int; } [ad_2] solved C++ template … Read more

[Solved] For every possible pair of two unique words in the file, print out the count of occurrences of that pair [closed]

[ad_1] It seems inconceivable that the purpose of your assignment determining the frequency of word-pairs in a file would be to have you wrap a piped-string of shell utilities in a system call. What does that possibly teach you about C? That a system function exists that allows shell access? Well, it does, and you … Read more

[Solved] Output in another file [closed]

[ad_1] The first issue is that the temp, temp2, and temp3 are int, but you are assigning double values to them, and then re-assigning these values back to double variables. You should make these double. You might want to consider using qsort() to sort these objects. #include <stdlib.h> // for qsort int compare_products(const void *p1, … Read more

[Solved] How to perform an action on one result at a time in a sql query return that should return multiple results?

[ad_1] Use a loop to iterate through the results of your query. SELECT EmailAddress FROM Customers` WHERE EmailFlag = ‘true’` AND DATEDIFF(day, GETDATE(),DateOfVisit) >= 90; Replace day with other units you want to get the difference in, like second, minute etc. c#: foreach(DataRow dr in queryResult.Tables[0].Rows) { string email = dr[“EmailAddress”].ToString(); // Code to send … Read more

[Solved] how to split a string for equation

[ad_1] To extract characters from a string and to store them into a Character Array Simple Method (Using string indexing): #include<iostream> using namespace std; // Using the namespace std to use string. int main(int argc, char** argv) { string input; cout << “Enter a string: “; cin>>input; // To read the input from the user. … Read more

[Solved] Scientific Calculator in C# [closed]

[ad_1] Firstly, this shouldn’t be a Java Specific question. Secondly, a quick google search could have given you this answer Including this one -> SCIENTIFIC CALCULATOR USING C-SHARP(C#.NET), which basically covers all the scientific functions you’re looking for including the Radian to Degree conversion [ad_2] solved Scientific Calculator in C# [closed]

[Solved] I need help trying to understand this piece of code about structures and pointers [closed]

[ad_1] p is a pointer to a structure – this means that p ‘holds’ the starting address for a structure in memory — Hence: p = d.elmts+i represents the starting address in memory, for the current structure (i represents the address offset). In this example memory has been allocated for ‘dictSize’ structures (i.e. the number … Read more