C Board  

Go Back   C Board > General Programming Boards > C# Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 04-14-2007, 12:22 AM   #1
C 1337
 
Meshal's Avatar
 
Join Date: Nov 2006
Posts: 70
does C# have pointers??

does c# have pointers !!

and if the answer is no ..

how can i implement the static/dynamic hashing?
Meshal is offline   Reply With Quote
Old 04-14-2007, 03:55 AM   #2
the hat of redundancy hat
 
nvoigt's Avatar
 
Join Date: Aug 2001
Location: Hannover, Germany
Posts: 2,769
The answer is yes and yes and no.

Basically, every reference type in .NET is a pointer.

You can have explicit pointers in unmanaged code including a ton of complications that come with the full unmanaged package.

And no, to the user, nothing in C# is handled like a pointer. There is no dereferencing or an -> operator.


I don't really know what you mean with dynamic/static hashing, but you can implement it in C#. Maybe you can explain what you want to achieve.
__________________
hth
-nv

She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."

When in doubt, read the FAQ.
Then ask a smart question.
nvoigt is offline   Reply With Quote
Old 04-14-2007, 12:39 PM   #3
C 1337
 
Meshal's Avatar
 
Join Date: Nov 2006
Posts: 70
thanks for answers my questions ..

and what i mean by static and dynamic hashing is this:
statick-hashing
http://www.cs.sfu.ca/CC/354/zaiane/m...00000000000000
http://www.dis.uniroma1.it/~catarci/...3LT/sld003.htm

dynamic hashing(extensible hashing)
http://www.dis.uniroma1.it/~catarci/...3LT/sld005.htm

how can i implement those hashing technique in C# , because i need a pointer to point to the buckets

buckets = blocks
Meshal is offline   Reply With Quote
Old 04-15-2007, 02:25 AM   #4
Cat without Hat
 
CornedBee's Avatar
 
Join Date: Apr 2003
Posts: 8,492
You use references to point to the buckets, in simple, standard C#. There's nothing special about hashing in this regard.
__________________
All the buzzt!
CornedBee

"There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
- Flon's Law
CornedBee is offline   Reply With Quote
Old 04-15-2007, 06:34 AM   #5
C 1337
 
Meshal's Avatar
 
Join Date: Nov 2006
Posts: 70
how i can reference to point to the bucket ??

can you show me an example ?!
Meshal is offline   Reply With Quote
Old 04-15-2007, 07:58 AM   #6
Cat without Hat
 
CornedBee's Avatar
 
Join Date: Apr 2003
Posts: 8,492
Code:
Bucket[] buckets = new Bucket[numBuckets];
__________________
All the buzzt!
CornedBee

"There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
- Flon's Law
CornedBee is offline   Reply With Quote
Old 04-15-2007, 08:52 AM   #7
Registered User
 
Join Date: Apr 2007
Posts: 45
Yeah gotta love C# for this particular ambiguity
__________________
we are one
wiiire is offline   Reply With Quote
Old 04-15-2007, 08:56 AM   #8
Cat without Hat
 
CornedBee's Avatar
 
Join Date: Apr 2003
Posts: 8,492
Which one?
__________________
All the buzzt!
CornedBee

"There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
- Flon's Law
CornedBee is offline   Reply With Quote
Old 04-15-2007, 09:09 AM   #9
Registered User
 
Join Date: Apr 2007
Posts: 45
Its illustrious memory handling
__________________
we are one
wiiire is offline   Reply With Quote
Old 04-16-2007, 03:22 AM   #10
C 1337
 
Meshal's Avatar
 
Join Date: Nov 2006
Posts: 70
so how can binary tree or binary search programmed in C# without using real pointers ?!!
Meshal is offline   Reply With Quote
Old 04-16-2007, 03:38 AM   #11
the hat of redundancy hat
 
nvoigt's Avatar
 
Join Date: Aug 2001
Location: Hannover, Germany
Posts: 2,769
C# has pointers. It's just that C# has nothing else that's probably a bit confusing. Every reference type in C# is what C++ would call a pointer. You just don't need to free the memory, because it's managed/garbage collected. And you don't need those pointer semantics/syntactics, because the compiler already knows if something is a pointer ( reference type ) or not ( value type ).

CObject* o = new CObject( "test" ); // perfectly valid C++

Object o = new Object( "test" ); // perfectly valid C#

Those two lines are exactly the same. An object is created dynamically.
__________________
hth
-nv

She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."

When in doubt, read the FAQ.
Then ask a smart question.
nvoigt is offline   Reply With Quote
Old 04-17-2007, 02:18 AM   #12
System Novice
 
siavoshkc's Avatar
 
Join Date: Jan 2006
Location: Tehran
Posts: 1,075
C# supports C++ type pointers. But it is called unsafe code. It is better to use .NET standard libs for those kind of operations OR you may go to MSDN for unsafe code.
__________________
Microsoft Visual Studio 2008 Professional (On Microsoft Windows XP SP2)

Learn the language before using it. (C++ Books and C Books)
Read the FAQ before making a problem.
Then make a Google and Forum search.

My code painter new version Version 0.97 DOWNLOAD NOW! (Let the pop up, pop!)

SiavoshKC
siavoshkc is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Using pointers to pointers steve1_rm C Programming 18 05-29-2008 05:59 AM
function pointers benhaldor C Programming 4 08-19-2007 10:56 AM
Request for comments Prelude A Brief History of Cprogramming.com 15 01-02-2004 10:33 AM
Staticly Bound Member Function Pointers Polymorphic OOP C++ Programming 29 11-28-2002 01:18 PM


All times are GMT -6. The time now is 04:32 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22