I just started learning pointers.
I'm going to bed now.
I just started learning pointers.
I'm going to bed now.
Warning: Opinions subject to change without notice
The C Library Reference Guide
Understand the fundamentals
Then have some more fun
...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";
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
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.
My best code is written with the delete key.
According to the first post, it's...
Quzah.Code:bed *caroundw5h;
Hope is the first step on the road to disappointment.
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.
"You are stupid! You are stupid! Oh, and don't forget, you are STUPID!" - Dexter
Originally Posted by quzah
WTF
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";
Last edited by caroundw5h; 06-23-2004 at 10:00 AM.
Warning: Opinions subject to change without notice
The C Library Reference Guide
Understand the fundamentals
Then have some more fun
>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.
My best code is written with the delete key.
thanks prelude. that actually gives me a little more understanding.
Warning: Opinions subject to change without notice
The C Library Reference Guide
Understand the fundamentals
Then have some more fun
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: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.
Hope is the first step on the road to disappointment.
Originally Posted by quzah
Warning: Opinions subject to change without notice
The C Library Reference Guide
Understand the fundamentals
Then have some more fun