I just started learning pointers.
I'm going to bed now.
Printable View
I just started learning pointers.
I'm going to bed now.
...ok?
Rule number 1 to follow when learning pointers: keep headache medicine in arms reach at all times :)
Is that
char *pointer = "hello";
or
char *hello = "pointer";
no its
char *string = "hello pointers";
by the way. Binky will help you out with pointers.
http://cslibrary.stanford.edu/104
>Rule number 1 to follow when learning pointers: keep headache medicine in arms reach at all times
The who and the what now? Pointers are very simple, people just think too hard when learning them and make things more difficult on themselves. The headache medicine is needed later when you start debugging a pointer related problem in a large application. :D
According to the first post, it's...
Quzah.Code:bed *caroundw5h;
I think pointers are only difficult to people who started on some higher level thing such as VB. Many of us started on C so we got them right up front.
And yes as prelude said, the real fun is when you have some bug where you overwrite some piece of memory because you did something stupid with a pointer. If the debugger doesn't catch it immediately, you're in for a wild ride.
Binky is awsome!
gg
Quote:
Originally Posted by quzah
WTF
:confused: I understood everything up till your post quzah. jokes. a pointer of type bed whose address value is attached to variable caroundw5h? right? Honestly, pointers don't seem that hard. I think It might be all the preface ppl make about it being the most confusing thing in C and so you kinda psyche yourself out.
As far as i'm cocerned right now. a pointer points to an object in memory - more specifically the addy's value, and seemingly you can manipulate that somehow is that right?
C doesn't necessarily have a string data type so it uses pointers for that sometimes likebut what can you really do with pointers. What are there true powers? how powerful are they? ppl make a big deal about them. Why? when you get down to manipulating addresses and such what can you really do?Code:char *string = "caroundw5h";
>a pointer points to an object in memory - more specifically the addy's value, and seemingly you can manipulate that somehow is that right?
A pointer is just another variable. The data it holds is an address, and you can either work with the pointer like any other variable, or dereference the pointer and work with the data at that address. This dual nature is what confuses people the most.
>What are there true powers?
There are a number of things that pointers can do, but the most obvious is linked data structures. Writing a dynamic linked data structure without pointers is tedious and not as intuitive.
thanks prelude. that actually gives me a little more understanding. ;)
I thought pointers were pretty easy, but then of course they can get complicated.Code:char (*(*x[3])())[5];
char (*(*x())[])();
Read it like you'd read a pointer declaration:Quote:
Originally Posted by caroundw5h
caroundw5h is a pointer to a bed. Now turn it into a sentence. Caroundw5h is pointed to their bed. Caroundw5h is headed to bed. Bah. Nevermind. It's not a joke if you have to explain it.
Quzah.
Quote:
Originally Posted by quzah
:D :D :D :D