473,322 Members | 1,345 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

questions on pointers

can someone please post some complicated question on pointers??

moreover while reading pointers I found out that there is a lot of
difference between an arracy of intergers and an array of
characters(string) ............. relating to
pointers ................am i correct................the way pointers
behave when they have a char array as an address and the way they
behave when they have an integer array as an address ????

please help as pointers is haunting me a lot ??? despite of being
quite old to 'C'

please help
Jun 27 '08 #1
3 3016
In comp.lang.c, JOhn wrote:
can someone please post some complicated question on pointers??
Not really. Depending on your POV, pointers are either trivially simple (and
thus there are /no/ complicated questions) or impossibly hard (and
thus /every/ question is a complicated question). For the trivially easy
POV, I have no questions, and for the impossibly hard POV, any question you
ask will be a complicated question. Such is life :-)
moreover while reading pointers I found out that there is a lot of
difference between an arracy of intergers and an array of
characters(string) ............. relating to
pointers ................am i correct................the way pointers
behave when they have a char array as an address and the way they
behave when they have an integer array as an address ????
No and yes. They behave exactly the same, conceptually.
Increment a pointer to an object and it will point at the next object
The /value/ of the pointer may differ with different objects, as different
objects have different sizes.

Thus, in both of the following code snippets
char a[3], *p;
p = &a[0] + 1;
and
int a[3], *p;
p = &a[0] + 1;
the pointer 'p' will point at a[1]

However, the /value/ of p (that is, the "address") may differ, as int values
are usually stored in bigger spaces than char values. Consequently
int a[3], *ip;
char *cp;
ip = &a[0] + 1;
cp = (char)&a[0] + 1;
will usually result in ip and cp having different values.
please help as pointers is haunting me a lot ??? despite of being
quite old to 'C'

please help
--
Lew Pitcher

Master Codewright & JOAT-in-training | Registered Linux User #112576
http://pitcher.digitalfreehold.ca/ | GPG public key available by request
---------- Slackware - Because I know what I'm doing. ------
Jun 27 '08 #2
JOhn <ga*****@gmail.comwrites:
can someone please post some complicated question on pointers??

moreover while reading pointers I found out that there is a lot of
difference between an arracy of intergers and an array of
characters(string) ............. relating to
pointers ................am i correct................the way pointers
behave when they have a char array as an address and the way they
behave when they have an integer array as an address ????

please help as pointers is haunting me a lot ??? despite of being
quite old to 'C'
The comp.lang.c FAQ is at <http://www.c-faq.com/>. Sections 4, 5, and
6 cover pointers. Have you read them?

Arrays of char and arrays of int behave essentially the same way with
respect to pointers as any other array type. Pointer arithmetic
operates in units of the size of the element type, 1 byte for pointers
to char, sizeof(int) bytes for pointers to int. If you can tell us
just what difference you're seeing, we can probably help clarify it
for you.

(Incidentally, using all lower case and long strings of '.' and '?'
characters doesn't help the readability of your article.)

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Jun 27 '08 #3
lee
On 5ÔÂ16ÈÕ, ÉÏÎç4ʱ52·Ö, JOhn <gaud...@gmail.comwrote:
can someone please post some complicated question on pointers??

moreover while reading pointers I found out that there is a lot of
difference between an arracy of intergers and an array of
characters(string) ............. relating to
pointers ................am i correct................the way pointers
behave when they have a char array as an address and the way they
behave when they have an integer array as an address ????

please help as pointers is haunting me a lot ??? despite of being
quite old to 'C'

please help
you can read a book named Puzzle c.
Jun 27 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Venn Syii | last post by:
I've searched all the forums but cannot find an answer to this question. I do the following: vector<MyClass*> myClassList; Later in the program I try to add to myClassList with a...
21
by: MOvetsky | last post by:
Is the following code ISO C++ standard compliant? If yes, is it guaranteed that it will not crash on compliant platforms? If yes, will it print "Pointers are equal" on any compliant platform? Will...
9
by: Gonçalo Rodrigues | last post by:
Hi all, I have a few questions on primitive types that I will divide in two main questions. I realize that some of these questions -- especially 2. below -- are not directly related to C++ as a...
54
by: Sander | last post by:
1. I was having a discussion with somebody and I think it's just religious. We are developing some software and he was looking through my code. I use if (pointer) to test a pointer for NULL. He...
3
by: sieg1974 | last post by:
Hi, I have made this simple program to understand char ** pointers, but I still having many questions. int main() { char ** testPointerPointerChar = 0; char * A = "string01";
50
by: Jatinder | last post by:
I 'm a professional looking for the job.In interview these questions were asked with some others which I answered.But some of them left unanswered.Plz help. Here are some questions on C/C++, OS...
7
by: Rano | last post by:
/* Hello, I've got some troubles with a stupid program... In fact, I just start with the C language and sometime I don't understand how I really have to use malloc. I've readden the FAQ...
4
by: PCHOME | last post by:
Hi! I have questions about qsort( ). Is anyone be willing to help? I use the following struct: struct Struct_A{ double value; ... } *AA, **pAA;
23
by: TefJlives | last post by:
Hi all, I'm learning a bit about C, and I have a few questions. I'm not trying to insult C or anything with these questions, they're just honestly things I don't get. It seems like pointers...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.