Dima
(╯°□°)╯
Dima
the best way is to tokenize the whole string without (s)(f)scanf
Marián
Alex
show code, I can`t understand your idea
Hermann
show code, I can`t understand your idea
https://pastebin.com/UNrp7L7z
Alex
you should assign pointer2=pointer only one time
Alex
and then increment pointer2 in loop
Alex
I can`t understand your idea at all for (int i=0; i<4; i++){ *pointer=i; *pointer2=pointer; ++pointer2; *pointer2=i; }
Alex
what do you want to do?
Hermann
create a uint8 pointer and assign values from an array to it
Hermann
like my problem mpz
Alex
just use memcpy
Anonymous
Does anyone know why the following link doesn't work: www.stroustrup.com/Programming
Hermann
just use memcpy
the problem is concat
Alex
?
Anonymous
No, I didn't. /programming.html works well. But the problem is with /Programming which is the supportive link for PPP book.
Anonymous
Thanks... I might consider sending an email to Bjarne Stroustrup himself about that.
Amit
Amit
Can anyone please explain what this syntax is?
Amit
Intializing (parameterized constructor) of base class from (parameterized constructor ) of derived class
Amit
My doubts are 1. There is no member variable in both child class, so what actually the parameterized constructor intializing here
Amit
2. Constructor are used to initialise member variable right? But can we create a new variable inside constructor and then intialise it from constructor itself
Anonymous
/warn no screen photos
Anonymous
2. Constructor are used to initialise member variable right? But can we create a new variable inside constructor and then intialise it from constructor itself
Mostly yes Constructors are used to initialize state of objects. In good programs state of objects are only dependent on member variables
Anonymous
But sometimes it can be global variables
Anonymous
And it's mostly bad
Anonymous
Or you can call global functions in the constructor
Walter
Can anyone differentiate between c , c++ and c++ and in which development they are used??
Walter
c#
Amit
Or you can call global functions in the constructor
Yeah that's is fine....but my question is .....what's the point of declaring new member inside a constructor and intializing them?
Amit
Mostly commonly what I have seen is declaration happens in class (outside constructor) and only intialization happens in constructor
Anonymous
Amit
If you declare a variable inside a constructor it's not a member variable of a class
Oh okie...that makes sense...but we can print it and intialise it with passing argument from object?
Amit
In this example....I'm passing value= 10 as argument
Anonymous
So?
Amit
Which is getting saved in a new variable declared inside constructor (not a class member)
Amit
So how that variable ( int x= i ) got it's value
Amit
When I'm passing a value =10 from Child class type of object
Amit
As you said - Class Parent{ Public: Parent(int i) { Int x= I ; // x not a class member here } };
Amit
So how Child class object is passing value to this variable 'x' ?
Alex
So how Child class object is passing value to this variable 'x' ?
before Child constr, Parent constructor is called with argument i(from Child constr), which creates x variable and init it with i
Amit
But how it took the parameter value i, before even getting called?
Amit
Moreover.....this syntax of passing object argument from child to parent class is confusing.....can please someone elaborate: Child(int j) : Parent(j)
Alex
you pass parameter to Child constr, it starts with initializer list. Parent in the initializer list. so Parent is called with i argument
Alex
constructor(args..): initializer_list { body.. } before body constructor deals with initializer list
Amit
you pass parameter to Child constr, it starts with initializer list. Parent in the initializer list. so Parent is called with i argument
Ohh okkie....before processing the child constr body.....intialiser list things getting processed- > so parent constr
Amit
Got it...thanks for essential piece man👍
Alex
if Parent is not in initialiser list it will be called anyway(with no arguments)
Amit
Can you clarify why not mentioning (int j) instead of (j) here for parent ? Child(int j) : Parent(j)
Alex
Alex
you already have Parent(int i)
Alex
so its like you have function void parent(int i) and then call it in child void child(int j) { parent(j); }
Amit
so its like you have function void parent(int i) and then call it in child void child(int j) { parent(j); }
Yeah got it....this is more clear and understandable syntax to use....wonder why we even use intiliaser list...anyway can google that thing
Amit
Btw thanks @kasha131
Amit
👍 appreciate
Alex
Yeah got it....this is more clear and understandable syntax to use....wonder why we even use intiliaser list...anyway can google that thing
if you don`t use initializer list, for every field and parent class default constructor is called. Thus, if you want to initialize variable with value is more efficient to do it like this constructor() : value("string") { } than constructor() { value = "string"; } cause in the second case default string() constructor is called for value, and then assignment operator. in the first case just constructor
Okiki
I need help with this 👇🏾 Using the formula A=ab(Siny/2) write a c# program to calculate the area of a triangle where Y=60degrees and a=b= 13cm
Patrick
What's the size of a shared_ptr's control block?
Patrick
How can I find out for my implementation though?
Anonymous
But why do you even care?
Patrick
Because I've implemented my own reference counting and want to compare
Patrick
Read the sources😂
How would I find those? On my system somewhere in the <memory> implementation?
Anonymous
Because I've implemented my own reference counting and want to compare
Well in most cases the control block contains: 1) atomic ref counter for std::shared_ptr 2) atomic ref counter for std::weak_ptr 3) deleter object
Patrick
I know what's in it, but I'd like to find the concrete numbers :)
Anonymous
Thanks @unterumarmung
Anonymous
How would I find those? On my system somewhere in the <memory> implementation?
But depending on C++ stdlib you're using you can find the sources on GitHub
Patrick
Yeah I was just now searching how to determine which I was using