Anonymous
Anonymous
but is that right?
Anonymous
hope so
Anonymous
Anonymous
9 is
00000000 00000000 00000000 00001001
in memory
then c first points to the first 00000000
doesn't
*(c+1) prints the 2nd 00000000 ?
Anonymous
No, it doesn't
std::cout does
Anonymous
😭 I meant cout<<*(c+1);
Anonymous
is that rightly explained by me?
Anonymous
Kinda
What is a result of an expression: c == p ? True or false?
Anonymous
yes
Anonymous
true
Anonymous
same memory address
Anonymous
What is the difference between NULL and 0?
Anonymous
first tell me was that right?
Anonymous
ohh missed casting on that
Anonymous
Kinda right
I can't fully judge that
Anonymous
I checked it but it gives
error: comparison between distinct pointer types 'char*' and 'int*' lacks a cast [-fpermissive]
if(c==p){
Anonymous
but I was kinda right in the way that both will have the same address.
Anonymous
isn't it?
Anonymous
Yes, it will
Anonymous
Anonymous
I've already told you that there is NO difference between NULL and 0 in C++
Anonymous
okk but have a look at this.
Neutronix
Anonymous
https://stackoverflow.com/questions/9894013/is-null-always-zero-in-c
Anonymous
The answer by john bode
Anonymous
We are talking C++, not C
Anonymous
C?
Anonymous
my goodness
Anonymous
but please see the link once.
Anonymous
C and C++ are separate languages
Anonymous
ya
Anonymous
does char *p = 0; make a difference in C?
Anonymous
No
Anonymous
Actually I don't know
Anonymous
did you check the answer by john bode?
Anonymous
But you shouldn't be worried about it
Anonymous
You're not writing embedded systems code where it can matter
Anonymous
sometimes things like that are asked in my exams.
Anonymous
whatever
Anonymous
but
Anonymous
so
char *p = (char*)0; is
same as char *p = NULL;
in CPP
Anonymous
?
Anonymous
Anonymous
It will be the same
Anonymous
How many times should I repeat that?
Pavel
Dima
Lol
Anonymous
Since NULL and 0 are same in cPP
Mihail
Anonymous
how is NULL represented in memory?
Anonymous
Why not?
It should be implicitly casted
S.
At most a warning
Anonymous
I_Interface
God damn, if u wanna null for ur ptr, just use nullptr, that's all Ajay
Anonymous
Pavel
It should be implicitly casted
Yes, and both C and C++ allow that implicit cast. There are warnings that can be enabled that will warn of use 0 instead of nullptr. But it will still compile
Anonymous
Pavel
C++ allows a lot of shit like that, you should not use it, but should know about it.
Anonymous
Anonymous
so NULL or 0 are implicitely type casted to (char*). is that so?
Anonymous
Yes
Anonymous
What the hell is written in the comment highlighted?
Anonymous
It's too early for you to know
Dima
p r o g r a m m i n g
Anonymous
You're not writing code in weird programming environments
Mihail
Anonymous
endianness ?
Mihail
Mihail
and x86 is little-endian
Anonymous
haha.
Anonymous
Mihail
Anonymous
I sussed what you meant to say. so I quickly replied you.