Anonymous
this is cxx group, read the rules
css is cxx though 😂😂
Anonymous
a^b 0<b<10^100?
Alim
Guys, please explain why the values ​​in memory in this program change. The program returns 20 2109490, instead of 20 20 #include <stdio.h> #include <stdlib.h> int main() { int num, *arr, i, buf, buf2; num = 7; arr = (int*) malloc(num * sizeof(int)); for(i = 0; i < num; i++) { *(arr + i * sizeof(int)) = 20; } buf = (int)(*(arr + 12)); printf("%d ", buf); buf2 = (int)(*(arr + 12)); printf("%d ", buf2); return 0; }
Dima
lol
I_Interface
lol
Dima
you are moving pointer offset
Dima
so it reads some garbage
Anonymous
Hello, I just completed a course in DS and algo and I am interested in building softwares using C++, what should I do next?
Alim
where&
Dima
practice, start your own projects
Anonymous
Here is the problem, I dont know how to transition from console based projects to actual functional projects
Anonymous
Hello friends
klimi
Hello!
Dima
Hello!
read her bio
Dima
Hello!
something is wrong
I_Interface
Hello friends
Nohello.com
klimi
I know it
klimi
She's genuine
klimi
Look at her innocent pfp
klimi
You guys have no soul
Dima
cute
I_Interface
Dima and Dima ?
Hugo
Hey guys, it seems that I often fall into a bad pattern that results in circular dependency issues. This is related to templated methods. I'll provide below a sample of the stated pattern. If someone has experience in how to avoid this, I'll be grateful :)
klimi
#pragma once
Hugo
Hey guys, it seems that I often fall into a bad pattern that results in circular dependency issues. This is related to templated methods. I'll provide below a sample of the stated pattern. If someone has experience in how to avoid this, I'll be grateful :)
/* a.hpp */ #include "b.hpp" class A { public: A() : b(*this) {} int whatever_property; private: B _b }; /* b.hpp */ class A; class B { public: B() = delete; B(A &a) : _a(a) {} template <typename T> void foo(T t) { //Here I need the complete type definition _a.whatever_property += t; } private: A &_a; };
Hugo
#pragma once
With my configuration, it won't prevent the error
Anonymous
Oh sorry
klimi
No worries!
RishiGss
any standard and complete resources or documentation for C and C++
Hugo
There's probably a better design, but I faced a similar problem a while ago and ended up changing the design
Generally it' s not a problem since we can move the complete type inclusion in a cpp file. But when I need to use both the templated parameter and the complete A type, I end up with this. It's very limiting
Hugo
I hope that c++ modules will improve this situation :) https://www.modernescpp.com/index.php/c-20-modules
Sasuke
Hey guys I learnt C now suggests me a project to practice
Sasuke
operating system
😂😂 that gonna take me mullions of year
klimi
then make a ....
klimi
hm then you can make a program to help people write with all ten fingers
klimi
Wtf?
yeah swear
Hugo
almost sure that circular dependencies will be forbidden in modules
Yeah it will. But it will be easier to scope what to import without having to over-split the header files.
klimi
be rude and expect others to be nice
klimi
bye
Sasuke
be rude and expect others to be nice
Man what kinda project is that?
klimi
normal project
Sasuke
You mean something which teaches how to type?
klimi
yes
Sasuke
Gui can do that job better I guess
Mity
Nope
🙄🙄🙄
Sasuke
🙄🙄🙄
That's apart I don't know yet
Mity
That's the basic thing
klimi
Gui can do that job better I guess
ok then make an operating system
Sasuke
ok then make an operating system
No no I will do this 😂😂😂
klimi
sure
klimi
i have done that before
klimi
its not hard
Mity
Go to hacker rank or some thing and solve algorithm
Mity
Using c
Sasuke
i have done that before
Cool can you show me how does it looks like
klimi
the my os? i can't i formated harddrive xD
klimi
Gui os?
just terminal with a shell
klimi
one tty you could say
Mity
just terminal with a shell
Ohh.. that's nice
klimi
but actually its not as that hard to go to basic vga graphics
Mity
I'm also learning shell😅
Sasuke
Go to hacker rank or some thing and solve algorithm
I did but small projects are more interesting
Pavel
Hey guys I learnt C now suggests me a project to practice
a roguelike game https://www.youtube.com/watch?v=vxF1osPkplA