Forum
Digit Technology Discussion Forum
>
Portables, Peripherals and Electronics
>
QnA (read only)
C question??
User Name
Remember Me?
Password
Register
FAQ
Calendar
Mark Forums Read
QnA (read only)
Mods please help transfer the contents of this forum to proper sections. :)
LinkBack
Thread Tools
Search this Thread
Display Modes
21-07-2007, 09:24 PM
#
1
(
permalink
)
devilzdad
Apprentice
Join Date: Feb 2007
Posts: 50
C question??
void main()
{
char far *ptr1,*ptr2;
printf("%d %d", sizeof(ptr1),sizeof(ptr2));
}
The output look like 4 2 why not it become 4 4.
Note: sorry guys its "sizeof(ptr2)"
Last edited by devilzdad; 21-07-2007 at
10:02 PM
.
Advertisements. Register and be a member of the community to get rid of them.
Advertisement
21-07-2007, 09:35 PM
#
2
(
permalink
)
Desi-Tek.com
In The Zone
Join Date: Oct 2006
Location: Mumbai
Posts: 365
Re: C question??
which compiler u are using?
__________________
Dhiraj Thakur
thakur.dheeraj(@)gmail.com
21-07-2007, 09:39 PM
#
3
(
permalink
)
Garbage
God of Mistakes...
Join Date: Dec 2005
Location: Pune, Maharashtra
Posts: 1,923
Re: C question??
Quote:
Originally Posted by
devilzdad
void main()
{
char far *ptr1,*ptr2;
printf("%d %d", sizeof(ptr1),sizeof(ptr1));
}
The output look like 4 2 why not it become 4 4.
I think it is bcoz the "far" is only for ptr1 & NOT for ptr2.
i.e. char
far *ptr1
,
*ptr2
;
Correct me if I'm wrong.....
__________________
Registered Linux User #468778
----------------------------------
http://twitter.com/_Garbage_
21-07-2007, 09:52 PM
#
4
(
permalink
)
Desi-Tek.com
In The Zone
Join Date: Oct 2006
Location: Mumbai
Posts: 365
Re: C question??
@
shirish_nagar
have a look at this line
Quote:
printf("%d %d", sizeof(ptr1),sizeof(ptr1));
so it should return the value of
ptr1 twice
but it is returning error on my compiler
__________________
Dhiraj Thakur
thakur.dheeraj(@)gmail.com
Last edited by Desi-Tek.com; 21-07-2007 at
10:15 PM
.
21-07-2007, 10:06 PM
#
5
(
permalink
)
devilzdad
Apprentice
Join Date: Feb 2007
Posts: 50
Re: C question??
guys i'm using Turbo C......
i got the answer 4, 2.....
but i'm not understanding the reason for dat??
its the first question in " Test your C skills-yeshwant kanetkar"
22-07-2007, 07:16 PM
#
6
(
permalink
)
Garbage
God of Mistakes...
Join Date: Dec 2005
Location: Pune, Maharashtra
Posts: 1,923
Re: C question??
hey...
devilzdad edited post last night...
Now look this...
Quote:
printf("%d %d", sizeof(ptr1),sizeof(ptr2));
__________________
Registered Linux User #468778
----------------------------------
http://twitter.com/_Garbage_
Bookmarks
Digg
del.icio.us
StumbleUpon
Google
«
Previous Thread
|
Next Thread
»
Thread Tools
Search this Thread
Show Printable Version
Email this Page
Search this Thread
:
Advanced Search
Display Modes
Linear Mode
Switch to Hybrid Mode
Switch to Threaded Mode
Posting Rules
You
may not
post new threads
You
may not
post replies
You
may not
post attachments
You
may not
edit your posts
BB code
is
On
Smilies
are
On
[IMG]
code is
On
HTML code is
Off
Trackbacks
are
On
Pingbacks
are
On
Refbacks
are
On
Forum Rules
Similar Threads
Thread
Thread Starter
Forum
Replies
Last Post
one question here??
SUKHI99
Software Q&A
1
29-03-2007
11:38 PM
C & C++ question
n2casey
Programming
16
05-03-2007
01:23 PM
a RAM question
anarchy0x
Hardware Q&A
8
11-01-2007
09:49 AM
one question pls....
mayneu
QnA (read only)
2
08-11-2006
10:54 PM
My question
Official Techie
QnA (read only)
6
30-10-2006
10:36 AM
Latest Threads
FAO Ice Cream Sanwich users
- by
ico
Dual Core Confusion!!!!
- by
rahulpv102
Must Play PC Games / Suggestion
- by
Piyush
Language learners' discussion thread !! :D
- by
icebags
Anonymous Strikes again!!
- by
clinton
the FOOTBALL channel
- by
Arsenal_Gunners
National Telecom Policy 2012 Approved
- by
ssk_the_gr8
Battlefield 3 Multiplayer Discussion
- by
Charan
Must Watch Movies Recommended By Digitians
- by
~Phenom~
Battlefield 3 discussion!
- by
cyborg47
Advertisement
All times are GMT +5.5. The time now is
12:09 AM
.
Contact Us
-
Thinkdigit.com
-
Archive
-
Top
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
LinkBack
LinkBack URL
About LinkBacks
Search Engine Optimization by
vBSEO
3.3.2