Beginners - January 2021 (Page 8)

by skcpp
High Address Preference in Stack
Is it true that structures are stored in stack starting from the highest hexadecimal address and in descending order? If yes, is there a good reason?
Jan 12, 2021 at 5:08pm
[2 replies] Last: Thanks dutch. Neat response! It makes sense that the "heap" grows upwa... (by skcpp)
by kmce
shared pointers
I have a question about shared pointers, I found code on a site that is talking about shared pointers and circular reference. In the code below when albert is a...
Jan 12, 2021 at 4:50pm
[9 replies] Last: That's a good question. Remember that it's a question of ownership, wh... (by dutch)
Binary Searching
Hello there! I just have a question. How can I solve this problem. It keeps getting error and I don't know how to answer the given error. #include<iostrea...
Jan 12, 2021 at 2:44pm
[2 replies] Last: Hello NoobCoder2333, In regards to the question that you deleted. You... (by Handy Andy)
by siid14
Segmentation Fault: 11
I get a segmentation fault, I do not understand why. Checked my code seems fine... Trying to get the reverse order of a list of numbers that I put in an array. ...
Jan 12, 2021 at 12:11pm
[3 replies] Last: it means nothing on stack to trace, but why would that happen? It is ... (by coder777)
by skcpp
Changing the starting address of an array (1,2)
Is there a use case at all for needing to change the starting address of an array at run time? The last assignment below fails because the code is trying to ass...
Jan 12, 2021 at 10:17am
[20 replies] Last: It's fun trying to work it out though. cpp.sh seems to be allocating ... (by lastchance)
Review of Code C++
I feel that much of the code is to par for a homework assignment. Yes, I'm being upfront about this being for school. I'm not asking for help, only a review of ...
Jan 12, 2021 at 6:37am
[7 replies] Last: > why is "using namespace std" considered bad practice? It is conside... (by JLBorges)
Get string and save in array of pointers in C++
Hello, I would like to get 10 string from the input and save in array of pointers. Like this: https://i.ibb.co/hMySjRZ/Untitled.jpg
Jan 11, 2021 at 9:32pm
[7 replies] Last: If there must be an array of pointers, we can do this: #include <ios... (by JLBorges)
by skcpp
Memory Mgmt in C++ (Basic Question)
Similar to malloc and calloc in good old C, does the developer need to manually manage memory allocation and destruction in C++, and if yes, does that exercise ...
Jan 11, 2021 at 6:35pm
[7 replies] Last: the c++ containers can be used in place of new and delete if you want ... (by jonnin)
Implementing queue using an array
Hello guys. I am trying to implement a queue by using an array. However my code has some flaws so please any piece of advice would be really helpfull. ...
Jan 11, 2021 at 6:29pm
[6 replies] Last: Thank you all very much for your precious posts! (by gevCplus)
by skcpp
Data type on stack
When a object or a pointer is declared with a data type, is the data type also stored on stack, and if so, in an adjacent location or somewhere else?
Jan 11, 2021 at 3:54pm
[10 replies] Last: Duh! Thanks it works now :-) (by skcpp)
Passing function pointer down through multiple functions
This may have been a little bit of a complicated project to start with especially since I knew nothing about C++ but I'm enjoying it (for the most part). I'v...
Jan 11, 2021 at 2:47pm
[7 replies] Last: You have Callback CallBack and _callback . No wonder you can't ke... (by dhayden)
Rhombus star pattern
What i can change in this code so it would print 8 rows without asking? #include <stdio.h> int main() { int i, j, rows; printf("Enter the...
Jan 11, 2021 at 12:14pm
[6 replies] Last: As C without multiple for loops, consider: #define _CRT_SECURE_NO_W... (by seeplus)
Storing words into an array from a file in reverse order, and write into a new File.
So, I'm currently trying to figure out how to open a file that has a ton of different words of different sizes. Then search for all the words in the file of a c...
Jan 11, 2021 at 11:08am
[17 replies] Last: @OP Despite your green tick an interesting problem arises if all the... (by againtry)
by dutch
Class function updating 2 variable
You need to post something that demonstrates the problem instead of some random crap.
Jan 11, 2021 at 3:41am
[2 replies] Last: The compiler is your friend: it tells what is wrong or likely to be wr... (by TheIdeasMan)
Database integration help?
Can someone offer some time on how to develop an application A-Z and how this works? Currently in school, almost done with my 2 year and really haven't learned ...
Jan 10, 2021 at 6:15pm
[no replies]
is it safe to use memcpy to serialise/deserialise PODs?
Hi I need to serialise and deserialise some POD structs. I was planning to use something like the following: #include <iostream> #include <cstring> using n...
Jan 10, 2021 at 5:12am
[3 replies] Last: > Binary is far superior to text in performance and space. > if you do... (by JLBorges)
appropriate way to deal with compiler warning non-void function doesn't return value in all paths
Sorry if this has been asked, I didn't find it. Working through Bjarne's PPP and using g++ on my mac. Total beginner. 99% sure I get the warning because my de...
Jan 9, 2021 at 11:01pm
[16 replies] Last: Thanks, Andy. No, it's part of this calculator code project. I wasn't ... (by mac10warrior)
Print Minimum and Maximum n-digit numbers whose sum of digits equals to given sum
Hello, I would like to print the minimum and maximum n-digit numbers whose sum of digits equals to given sum. 1<=m<=100 0<=s<=900 for example: 2 15 ...
Jan 9, 2021 at 9:31pm
[10 replies] Last: My try; #include <string> #include<iostream> #include<vector> using... (by oggin)
by y19177
A question
Can someone have a look at my code? I'm trying to approximate pi by using the formula pi = lim 4*(1-1/3+1/5-...+(-1)^n/2n+1). When I compile my code, it always ...
Jan 9, 2021 at 5:26pm
[8 replies] Last: You can always add up the terms in pairs - then you will never have to... (by lastchance)
XP value is constant
With this the value of xp does not change and I can't tell why. #include <iostream> #include <conio.h> #include <cstdlib> #include <time.h> #include...
Jan 9, 2021 at 10:56am
[4 replies] Last: Solution found. Thanks for pointing out that line, @jonnin (by closed account 2LC20pDG)
January 2021 Pages: 1... 67891011
  Archived months: [dec2020] [feb2021]

This is an archived page. To post a new message, go to the current page.
Registered users can post in this forum.