- Strength to Increase Rep
- +0
- Strength to Decrease Rep
- -0
- Upvotes Received
- 5
- Posts with Upvotes
- 5
- Upvoting Members
- 5
- Downvotes Received
- 0
- Posts with Downvotes
- 0
- Downvoting Members
- 0
19 Posted Topics
Re: Use [iCODE]isascii()[/iCODE] function, to check if the character is ascii. | |
Re: In the [iCODE]main()[/iCODE] function you have not allocated memory for the pointer [iCODE]d[/iCODE], In this code you are trying to store values in the unallocated memory which leads to undefined behavior. | |
| |
Re: [iCODE]int a[] = {0};[/iCODE] has only one memory defined to the array [iCODE]a[/iCODE] i.e., [iCODE]a[0][/iCODE] which is initialized to zero. The only valid index in this case is [iCODE]a[0][/iCODE]. If you try to access other locations then it is an undefined behaviour. | |
Re: The array [iCODE]a[][/iCODE] shall have sufficient memory for merging, the memory from [iCODE]a[20][/iCODE] is simply undefined in your code, the only valid region is from [iCODE]a[0][/iCODE] to [iCODE]a[19][/iCODE]. | |
Re: Are you sure each time during recursion the value for [iCODE]x[/iCODE] and [iCODE]y[/iCODE] are what you expect to pass to the [iCODE]neighbour()[/iCODE] function, i was wondering negative values for [iCODE]x[/iCODE] and [iCODE]y[/iCODE] or the values greater than the index of [iCODE]S[y][x][/iCODE]. Like y being 1000 and x being 5000, if … | |
Re: 1. Try the program. 2. Post the code where you have the problem. 3. People here will be happy to help, when you have at least tried it. | |
Re: No difference. [ICODE]return[/ICODE] is not a function, but an operator. It is [ICODE]like int a = (3);[/ICODE] | |
Re: [iCODE]scanf ("%d",&num[i]);[/iCODE] should have been [iCODE]scanf ("%d",&num[i][j]);[/iCODE] | |
Re: [iCODE]int a;[/iCODE] is a declaration as well as definition. This c statement not only says the type of the variable but also allocates the memory required for this variable. | |
Re: you are not storing the month and day information in the form of an array as you have done for [iCODE]daysArray [/iCODE]in the function [iCODE]getCalendarDates[/iCODE]., i.e., there are no arrays for month and days but you have array for years [iCODE]yearsArray[/iCODE]. | |
Re: If your intention is to get a unsigned integer use %u format specifier. | |
Re: 1. [iCODE]userWord != dictWord[/iCODE] for the while loop is wrong instead use false == found. 2. Close the file while exiting the function. 3. [iCODE]realloc(userAnswers, sizeof(char) * int(max_word_size)); [/iCODE] should have been [iCODE]realloc(userAnswers, sizeof(char) * int(max_word_size) * size); [/iCODE] | |
Re: There are many places in the code where pointer is expected, but you are passing the parameter by value; example: [iCODE]load_data(), get_accountID(), print_to_outfile()[/iCODE]. The compiler should have given warning regarding this. | |
Re: In main function when the data '34534' is added, the pointer bottom points to '34534', when the second data '789' is inserted, the insertion takes place but your code is such that the pointer bottom will be still pointing to the data '34534'. When you call the function [iCODE]ll.printall()[/iCODE] the … | |
Re: [icode]num_students[/icode] is a local variable in main function which is initalized to zero. After calling the function [icode]read_calcData[/icode] the variable [icode]num_students[/icode] will be zero because you have not passed the address of [icode]num_students[/icode] to the function [icode]read_calcData[/icode] where the number of students is calculated. The [icode]num_students[/icode] variable is local to … | |
Re: *Use code tags while posting. *Take an example of n=10; then single step through the for loop of the code to understand the working of the code: for the first time in the loop: i = 1 then n-i+1= 10, hence [iCODE]v_out[1][/iCODE] is assigned the value [iCODE]v_in[10].[/iCODE] for the second … | |
Re: 1. Do not use `void main()`. 2. Always try to free the memory which is allocated. 3. When you run the program for the second time by deleting `insert` and `write_file`, then the `strlen` function will be garbage. i.e, `strlen((*s)->p, [ctr].n.FName)`, , `strlen((*s)->p[ctr].n.LName)`, and `strlen((*s)->p[ctr].course)`, in the `read_file`, function are … | |
Re: you need to pass the variables point1, point2, center1 and center2 from the main() function to the distance() function, so that the values obtained in the main function can be passed to the distance() function The prototype of the distance function can be [code=C++] double distance(double point1, double point2, double … |
The End.