General statistics
List of Youtube channels
Youtube commenter search
Distinguished comments
About
Toby
freeCodeCamp.org
comments
Comments by "Toby" (@toby9999) on "Pointers in C / C++ [Full Course]" video.
Not sure whether you're referring to C2[i]? He says that a lot... remember that indexes are zero based, so... C2[0] == 'H' C2[1] == 'e' C2[2] == 'i'
2
It might work by pure luck if the byte following already happens to be NULL. But you should always null terminate string literals else major bug looming.
1
printf can also output hex. Just saying. And no, d - 4 = 9
1
The character is 1 byte. The pointer is 4 bytes. In a 64 bit app, a pointer is typcally 8 bytes.
1
And your problem is...
1
You're referring to the 2nd byte of a 4 byte value.... so it's actually this... 00000100 00000001 2^10 + 1
1
Not really.
1
I have not encountered float = 8 bytes in 30 years of coding. I only see float=4 bytes, double=8 bytes.
1
In the simple case, it doesn't matter which way you write it, but you have it backward... the * belongs to the P (conceptually). The * is not the type. It is saying P is a pointer to the type. Think about this example... int X, *Y;
1
In 64bit code, pointers are 64bits. Be careful with casts.
1