Anonymous
but is that right?
Anonymous
hope so
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
What is the difference between NULL and 0?
Depending on the run-time environment -Apart from 0, A value in memory location can be chosen as NULL in cpp.
Anonymous
What is the difference between NULL and 0?
Before you asked the question - I was actually googling the exact same thing.
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
Just include your headers uding #include directive
Hi Rwik, i've tried but doesn't worl
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
does char *p = 0; make a difference in C?
And it won't compile in either C ot C++
Anonymous
Anonymous
It will be the same
Anonymous
How many times should I repeat that?
Anonymous
And it won't compile in either C ot C++
#include<bits/stdc++.h> using namespace std; int main(){ char *c = 0; //cout<<*c; return 0; } this compiles well
Dima
Lol
Anonymous
Since NULL and 0 are same in cPP
Anonymous
Why shouldn't it?
Well, Danya told me that it won't compile. See the message above it.
Anonymous
how is NULL represented in memory?
Anonymous
Why not?
It should be implicitly casted
S.
At most a warning
I_Interface
God damn, if u wanna null for ur ptr, just use nullptr, that's all Ajay
Anonymous
In c++ it's just #define NULL 0
I've told you already
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
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
Anonymous
endianness ?
Mihail
and x86 is little-endian
Anonymous
haha.
Mihail
Anonymous
I sussed what you meant to say. so I quickly replied you.
Mihail
Actually yes, if it is an singed
yes if it's both unsigned and big-endian