Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C > Doubts about po...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 73 Topic 25129 of 27671
Post > Topic >>

Doubts about pointers

by Simon <nospam@[EMAIL PROTECTED] > Mar 26, 2008 at 08:03 PM

Hello friends,

I have a couple of doubts about pointers in C.


1) I have a function with prototype is :

 my_funtion(char far * char);

I need to pass it an array of char which I have defined as follows:

 char my_array[10]

The question is: is it allright to typecast to a far pointer? e.g.
int i=my_function( (char far *) ( (char *) my_array );

I think I am still only passing a near pointer, so how do I force
the segment to be passed also? 


2) As expected, (char far *) NULL is NULL, but if I set
char near *x = NULL,  
then  (char far *)x is non-NULL (the segment is non-zero)!

This seems crazy, it means that if you have a prototyped function
with a far pointer argument (maybe NULL) and you have some
near-mode address from somewhere else (maybe NULL),
you have to handle the NULL case specially. What's going on?


I am using Borland Turbo-C 2.01 if it's relevant.

Thanks.
 




 73 Posts in Topic:
Doubts about pointers
Simon <nospam@[EMAIL P  2008-03-26 20:03:54 
Re: Doubts about pointers
roberson@[EMAIL PROTECTED  2008-03-26 20:17:56 
Re: Doubts about pointers
CBFalconer <cbfalconer  2008-03-26 17:44:48 
Re: Doubts about pointers
Ian Collins <ian-news@  2008-03-27 09:20:34 
Re: Doubts about pointers
jacob navia <jacob@[EM  2008-03-26 21:32:07 
Re: Doubts about pointers
Simon <nospam@[EMAIL P  2008-03-26 22:11:03 
Re: Doubts about pointers
Ian Collins <ian-news@  2008-03-27 11:15:53 
Re: Doubts about pointers
Keith Thompson <kst-u@  2008-03-26 15:40:16 
Re: Doubts about pointers
jacob navia <jacob@[EM  2008-03-26 23:45:45 
Re: Doubts about pointers
Richard Heathfield <rj  2008-03-27 06:10:53 
Re: Doubts about pointers
Richard <devr_@[EMAIL   2008-03-26 23:46:52 
Re: Doubts about pointers
santosh <santosh.k83@[  2008-03-27 08:09:43 
Re: Doubts about pointers
CBFalconer <cbfalconer  2008-03-27 02:38:58 
Re: Doubts about pointers
santosh <santosh.k83@[  2008-03-27 14:28:02 
Re: Doubts about pointers
Keith Thompson <kst-u@  2008-03-27 12:08:19 
Re: Doubts about pointers
Ian Collins <ian-news@  2008-03-28 09:04:40 
Re: Doubts about pointers
santosh <santosh.k83@[  2008-03-28 06:58:14 
Re: Doubts about pointers
Keith Thompson <kst-u@  2008-03-27 23:01:52 
Re: Doubts about pointers
Richard Heathfield <rj  2008-03-28 06:58:45 
Re: Doubts about pointers
santosh <santosh.k83@[  2008-03-28 14:51:44 
Re: Doubts about pointers
Richard Heathfield <rj  2008-03-28 09:37:52 
Re: Doubts about pointers
dj3vande@[EMAIL PROTECTED  2008-03-28 14:50:59 
Re: Doubts about pointers
Richard Heathfield <rj  2008-03-28 15:21:30 
Re: Doubts about pointers
dj3vande@[EMAIL PROTECTED  2008-03-28 15:46:39 
Re: Doubts about pointers
santosh <santosh.k83@[  2008-03-30 07:51:21 
Re: Doubts about pointers
CBFalconer <cbfalconer  2008-03-29 23:08:39 
Re: Doubts about pointers
Richard Heathfield <rj  2008-03-30 07:46:08 
Re: Doubts about pointers
santosh <santosh.k83@[  2008-03-30 07:59:36 
Re: Doubts about pointers
CBFalconer <cbfalconer  2008-03-28 11:15:42 
Re: Doubts about pointers
CBFalconer <cbfalconer  2008-03-27 15:29:00 
Re: Doubts about pointers
Ian Collins <ian-news@  2008-03-27 16:48:52 
Re: Doubts about pointers
Nick Keighley <nick_ke  2008-03-27 02:11:59 
Re: Doubts about pointers
CBFalconer <cbfalconer  2008-03-27 15:30:44 
Re: Doubts about pointers
John Bode <john_bode@[  2008-03-27 15:34:07 
Re: Doubts about pointers
Richard Heathfield <rj  2008-03-27 22:55:10 
Re: Doubts about pointers
Nick Keighley <nick_ke  2008-03-28 03:22:03 
Re: Doubts about pointers
CBFalconer <cbfalconer  2008-03-28 11:25:49 
Re: Doubts about pointers
Nick Keighley <nick_ke  2008-03-29 05:24:02 
Re: Doubts about pointers
santosh <santosh.k83@[  2008-03-29 18:21:27 
Re: Doubts about pointers
Richard Heathfield <rj  2008-03-29 13:01:45 
Re: Doubts about pointers
santosh <santosh.k83@[  2008-03-29 20:28:10 
Re: Doubts about pointers
Richard Heathfield <rj  2008-03-29 15:08:09 
Re: Doubts about pointers
santosh <santosh.k83@[  2008-03-29 20:46:57 
Re: Doubts about pointers
Richard Heathfield <rj  2008-03-29 15:27:20 
Re: Doubts about pointers
santosh <santosh.k83@[  2008-03-29 21:37:47 
Re: Doubts about pointers
CBFalconer <cbfalconer  2008-03-29 10:13:40 
Re: Doubts about pointers
Anand Hariharan <znvyg  2008-03-29 21:39:11 
Re: Doubts about pointers
Richard Heathfield <rj  2008-03-29 21:08:59 
Re: Doubts about pointers
jacob navia <jacob@[EM  2008-03-29 22:52:12 
Re: Doubts about pointers
Anand Hariharan <znvyg  2008-03-29 22:52:51 
Re: Doubts about pointers
Richard Heathfield <rj  2008-03-29 22:20:28 
Re: Doubts about pointers
Anand Hariharan <znvyg  2008-03-29 23:37:53 
Re: Doubts about pointers
Richard Heathfield <rj  2008-03-29 23:19:06 
Re: Doubts about pointers
santosh <santosh.k83@[  2008-03-30 07:03:43 
Re: Doubts about pointers
Morris Dovey <mrdovey@  2008-03-29 21:48:31 
Re: Doubts about pointers
ymuntyan@[EMAIL PROTECTED  2008-03-29 16:29:55 
Re: Doubts about pointers
Richard Heathfield <rj  2008-03-29 23:52:01 
Re: Doubts about pointers
Chris McDonald <chris@  2008-03-29 23:52:29 
Re: Doubts about pointers
Richard Heathfield <rj  2008-03-30 00:12:23 
Re: Doubts about pointers
Chris McDonald <chris@  2008-03-30 00:29:29 
Re: Doubts about pointers
Richard Heathfield <rj  2008-03-30 00:42:51 
Re: Doubts about pointers
Chris McDonald <chris@  2008-03-30 00:54:07 
Re: Doubts about pointers
Morris Dovey <mrdovey@  2008-03-29 20:24:36 
Re: Doubts about pointers
Richard Heathfield <rj  2008-03-30 07:30:54 
Re: Doubts about pointers
ymuntyan@[EMAIL PROTECTED  2008-03-29 17:21:42 
Re: Doubts about pointers
Richard Heathfield <rj  2008-03-30 00:36:22 
Re: Doubts about pointers
Anand Hariharan <mailt  2008-03-29 22:10:37 
Re: Doubts about pointers
Richard Heathfield <rj  2008-03-30 07:36:19 
Re: Doubts about pointers
CBFalconer <cbfalconer  2008-03-29 23:13:00 
Re: Doubts about pointers
ymuntyan@[EMAIL PROTECTED  2008-03-30 17:49:59 
Re: Doubts about pointers
Richard Heathfield <rj  2008-03-31 01:43:17 
Re: Doubts about pointers
ymuntyan@[EMAIL PROTECTED  2008-03-30 19:13:20 
Re: Doubts about pointers
Richard Heathfield <rj  2008-03-31 02:43:09 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Oct 11 8:25:53 CDT 2008.