Pruthviraj
I am good with basics of c
Pruthviraj
But I want to get more hands on experience
Pruthviraj
So that I will be able to write code well
Anonymous
https://www.youtube.com/watch?v=oHg5SJYRHA0
Anonymous
He is the best. He will never let you down.
Bintr
wasup
Kakashi
can anybody tell me something graphics.h
Kakashi
we are on college project in which we supposed to use it
Kakashi
Don't use it
may i know why?
Kakashi
i know its outdated
Francisco
may i know why?
There're superior alternatives for graphics, like SFML, SDL2, Qt, ImGui, OpenGL, Vulkan, GTK, WxWidgets, etc
Kakashi
tell me about it
Kakashi
will yah?
Francisco
we are on college project in which we supposed to use it
If they force you to use it, okay, go on, but don't take it as the norm, because it isn't
Francisco
will yah?
I can tell you I normally use SFML, it's quite simple and gives you really good results
Kakashi
ok please
Francisco
Just check the official documentation, you have everything that you might need there
Kakashi
Thanks buddy
Anonymous
Alright thanks again, for the comprehensive answer.
Francisco
/report
Ибраги́м
/ban
AJ
Anyone from Germany
Hakan
Hi all. I cant understand bitwise operators. I using example, 10 & 5 this is a return new number. what using bitwise operators? what make returned new value?
Anonymous
Hi all. I cant understand bitwise operators. I using example, 10 & 5 this is a return new number. what using bitwise operators? what make returned new value?
0000 0000 0000 0000 0000 0000 0000 1010 (uint32_t 10) 0000 0000 0000 0000 0000 0000 0000 0101 (uint32_t 5) ———————————————————— bitwise AND 0000 0000 0000 0000 0000 0000 0000 0000 (uint32_t 0)
Hakan
yes but where i will use returned value 0?
Anonymous
0000 0000 0000 0000 0000 0000 0000 1010 (uint32_t 10) 0000 0000 0000 0000 0000 0000 0000 0101 (uint32_t 5) ———————————————————— bitwise AND 0000 0000 0000 0000 0000 0000 0000 0000 (uint32_t 0)
0000 0000 0000 0000 0000 0000 0000 1010 (int32_t +10) 1111 1111 1111 1111 1111 1111 1111 1011 (int32_t -5) ———————————————————— bitwise AND 0000 0000 0000 0000 0000 0000 0000 1010 (int32_t +10)
Hakan
what is 0 mean? it is not true or false. i must know returned value before?
Anonymous
Anonymous
-0
lol
Anonymous
lol
Actually exists
Anonymous
Actually exists
not in 2's complement code
Hakan
logic gate and is same this and?
Anonymous
logic gate and is same this and?
all ANDs are same as logic gate AND
Anonymous
logic gate and is same this and?
did you look at the second example?
Hakan
yes
Anonymous
yes
here's more 0011 1010 (uint8_t 58) 0110 0010 (uint8_t 98) ————— bitwise AND 0010 0010 (uint8_t 34)
Hakan
example i would use if statement true & true this is will return true i know. but i cant understand bitwise & because its result not true or false. it is return new bits value.
Anonymous
Both will work
no. bitwise AND won't work on floats for example
Anonymous
But booleans are not floats
:/ bitwise AND doesn't work on booleans directly
Anonymous
but same means
no. f(x) && g(y) means evaluate the effect and side effects of f(x) first. check if the return value (effect) converts to 0/false. if it is, we are done and the return value is 0/false. do not evaluate g(y). if it isn't, evaluate g(y). if the return value of g(y) converts to 0/false return 0/false, otherwise return true.
Anonymous
f(x) & g(y) means evaluate f(x) and g(y) in an unspecified order (the side effects can occur in any order). then convert the return values of f(x) and g(y) to appropriate integers and perform a bitwise AND to produce a new integer
Anonymous
Hi everyone! char* response; printf(“please type something:”); gets(response); printf(“you typed %s”, response); What’s wrong with this code?
Mar!o
Bruh you have an empty pointer
Mar!o
Yes you need a local array or dynamic one
Anonymous
I couldn’t figure it out
Mar!o
char response[256];
Mar!o
256 is the number of chars
Anonymous
Okay, another missing detail?
Mar!o
No...
Anonymous
Okay, another missing detail?
Try using fgets instead of just gets
Anonymous
Thanks :)
Anonymous
I just started learning dynamic memory, so I have another problem :/ int* X=malloc(3*n); int *Y=X; free(Y); Does this free the original memory? Why isn’t a pointer NULL after calling free? Thanks.
Mar!o
I just started learning dynamic memory, so I have another problem :/ int* X=malloc(3*n); int *Y=X; free(Y); Does this free the original memory? Why isn’t a pointer NULL after calling free? Thanks.
Yes it does free the original but free does not set it to null. Do this manually to prevents bugs like double free. That's why I always write my own small allocator/reallocator/reallocator wrapper functions...
Anonymous
Thanks again
Mar!o
Anonymous
Okay, another missing detail?
gets() has been removed from the C standard library since C11
Anonymous
Oh thanks
Noarch
OK,thx
Brief
Hey
Emir
How can i point a 2D array with a pointer and how can manipulate the array https://paste.ubuntu.com/p/2xBhKPCgdP/
Emir
2d array is just pointer to a pointer
but i want to my array is in heap
Brief
Photo de Brief
Brief
please look at this diagram and help me to display the message corresponding to each sensor while knowing that when the 2nd sensor is active the 1st is also active and when the 3rd sensor is active the 2 others are also and so on
Jin
Emir
2d array is just pointer to a pointer
https://paste.ubuntu.com/p/54y7bPshdF/ i get seg fault error
Anonymous
Busy with work