Pointers in C language for Newbies - a DEMO in Debugger

by CaptBry
(Oceanside, CA)

After searching the WEB and STILL not being able to use pointers effectively, I finally wrote a SIMPLE program to Demonstrate Pointers using the Debugger.

It's written in MikroC (free download, 2K program limit) that has a great Debugger where you can WATCH what pointers do.

Its such a simple program, it should be easy to modify it to run in almost any C language compiler with a good Debugger feature.

Now Newbies like me can finally understand and can use pointers effectively.

Enjoy!

Click this link to view the source code where you can copy and paste the program code:

Pointers in C language for Newbies


Comments for Pointers in C language for Newbies - a DEMO in Debugger

Average Rating starstarstarstarstar

Click here to add your own comments

Apr 20, 2016
Rating
starstarstarstarstar
Advice please! NEW
by: Mary

I have the error popping up. It says:rror message "incompatable types" . Does anybody know how to fix it? It is really important for my project at http://www.casestudywriter.org/case-study-for-sale.

Sep 10, 2015
Rating
starstarstarstarstar
Nice
by: Anonymous

Your work on this website is really amazing.This website is about best microcontroller projects.It contains a lot of interesting data from which students can get help to do their microcontroller projects.

Feb 20, 2015
Rating
starstarstarstarstar
Array sizing 7 or 8?
by: Anonymous

Many Compilers use the zero position, so an array of 7 characters has 8 bytes assigned to it.

Experiment with your compiler of choice so you can see how they are assigned, and more importantly, the array is protected from over-writes during execution.


Jun 14, 2013
Rating
starstarstarstarstar
Pointers Array
by: FreddyDog

Why not use
char letters[] = "1234567" the compiler will automatically compute the array size.
And the size is 8 not 7 becaus
"1234567" plus the hex 00 string terminator.

Dec 18, 2010
Rating
starstarstarstarstar
UPDATED CODE
by: CaptBry

THE CODE SEEMS TO HAVE BEEN CORRUPTED; INVISIBLE CHARACTERS EMBEDDED IF YOU COPY/PASTE IT.

I RE-WROTE THE CODE, TESTED IT IN MIKROC AND AM UPLOADING IT TO THIS PAGE VIA ITS OWNER.
PLEASE STAND BY

Dec 18, 2010
Rating
starstarstarstarstar
Assigning Arrays
by: CaptBry

char letters is an array.
seems there's a typo since the Array Size should be 7

try:
char letters[7] = "1234567";

note the square brackets.

I've had trouble with this king of "define and assign" single statement in various compilers.

Check the Help on Arrays. it might advise

char letters[7];
then load the characters into the array individually with a for 1 to 7 loop.

Of course using Pointers lets you just change the array's address to your character string ;-)

enjoy!



Dec 18, 2010
Rating
starstarstarstarstar
Error message
by: Chuck Wright

char letters7 = "letter"; // ASCII arrays
mikroC error message "incompatable types"
Please advise.

Click here to add your own comments

Join in and write your own page! It's easy to do. How? Simply click here to return to Project Showcase.


Privacy Policy | Contact | About Me

Site Map | Terms of Use