Posts by Henrique Hott • 183 points
11 posts
-
0
votes1
answer16
viewsQ: Use of _set in Django framework
I’m following the framework tutorial but I got lost in the use of the command _set of the shell initialized by python manager.py shell. The sequence of commands is as follows:: from polls.models…
-
3
votes1
answer26
viewsA: char array comparison returns false even for char[] equal - C
The problem is that the function strcmp() returns the value 0 if the two strings are equal, and in C, the value 0 represents the false, then the right way to compare is: strcmp(stringA, stringB) ==…
-
0
votes1
answer27
viewsA: "Segmentation fault(core dumped)" error in C language if-Else program
Your code has some problems: First problem: printf("Digite um valor para x:\n", &x); The symbol & serves, in that case, to pass a memory address, would have no problem pass a memory address…
-
4
votes1
answer38
viewsQ: Use of delete in an abstract class pointer
Reading the book A tour of C++, in a section on memory leakage, when I came across 3 statements regarding the code below: The implementation of Smiley may fail to delete pointer to mouth. The…
-
3
votes1
answer51
viewsA: Doubt in a Python Exercise
The best thing for your problem is to use the function range(minValue, maxValue, step), because you can iterate perfectly as the description asks, and to check if a number is divisible by 7, just…
pythonanswered Henrique Hott 183 -
1
votes1
answer27
viewsA: How do Return only return first index from the list, Python3.9?
The command return completes the function, so when you do the loop and puts the return within it, it returns only the first element of loop and then the function ends, the correct one is returns the…
-
0
votes2
answers44
viewsA: Store words in a "char" vector
You initialized very small arrays for both Cpf, and both the regions, so to solve the reported problem just add more at each startup, as in the code below. #include <stdio.h> #include…
-
1
votes5
answers96
viewsA: Matrix with out-of-range index returning correct values
Important to understand what is happening: The memory of the array is stored sequentially on the computer. So when you use matrix[0][6] it starts from the beginning of the Matrix until the seventh…
-
0
votes2
answers90
viewsQ: Printf() showing strange characters
The purpose of the code is to show all substrings of the variable firstString that has the same size as the second string that is the variable secondString. However, when I use the printf("%s\n",…
-
0
votes1
answer49
viewsQ: Add nodes to the chained list using loop
I did not find any similar question, in case you have, please indicate and I delete the post. How to create a chained list so I can use a for loop to put the nodes in the list. I’m using two…
-
0
votes2
answers65
viewsA: How to search a list item and return in a message?
The basic logic is, as soon as the code is called it iterate the list of possible fruits and test whether the target fruit is contained in the current fruit. Important points: Accentuation and…