Skip to main content
Post Made Community Wiki by Yam Marcovic

Why did the C master Dennis Ritchie introduce pointers in cC?

Because pointers are a very powerful mechanism that can be used in many ways.

And why did the other programming languages like vbVB.netNET or javaJava or c#C# eliminate them?

Because pointers are a very dangerous mechanism that can be misused in many ways.

I think programmers should learn about pointers, but from an educational perspective, it is unwise to introduce them early. The reason is that they are used for so many different purposes, it's hard to tell as a beginner why you are using a pointer in a particular circumstance.

Here is an incomplete list what pointers are used for:

  • dynamic allocation (new T)
  • recursive data structures (struct T { T* next; /* ... */ };)
  • iterators over arrays (for (T* p = &a[0]; p != &a[0] + n; ++p) { ... })
  • shared access to objects (T* new_pointer = existing_pointer;)
  • subtype polymorphism (T* pointer_to_base = pointer_to_derived;)
  • legacy call by reference (mutate(&object);)
  • optional types (if (p) { /* ... */ })

Note that using a single mechanism for all of these concepts demonstrates both the power and elegance for the experienced programmer and the great confusion potential for someone new to programming.

Why did the C master Dennis Ritchie introduce pointers in c?

Because pointers are a very powerful mechanism that can be used in many ways.

And why did the other programming languages like vb.net or java or c# eliminate them?

Because pointers are a very dangerous mechanism that can be misused in many ways.

I think programmers should learn about pointers, but from an educational perspective, it is unwise to introduce them early. The reason is that they are used for so many different purposes, it's hard to tell as a beginner why you are using a pointer in a particular circumstance.

Here is an incomplete list what pointers are used for:

  • dynamic allocation (new T)
  • recursive data structures (struct T { T* next; /* ... */ };)
  • iterators over arrays (for (T* p = &a[0]; p != &a[0] + n; ++p) { ... })
  • shared access to objects (T* new_pointer = existing_pointer;)
  • subtype polymorphism (T* pointer_to_base = pointer_to_derived;)
  • legacy call by reference (mutate(&object);)
  • optional types (if (p) { /* ... */ })

Note that using a single mechanism for all of these concepts demonstrates both the power and elegance for the experienced programmer and the great confusion potential for someone new to programming.

Why did the C master Dennis Ritchie introduce pointers in C?

Because pointers are a very powerful mechanism that can be used in many ways.

And why did the other programming languages like VB.NET or Java or C# eliminate them?

Because pointers are a very dangerous mechanism that can be misused in many ways.

I think programmers should learn about pointers, but from an educational perspective, it is unwise to introduce them early. The reason is that they are used for so many different purposes, it's hard to tell as a beginner why you are using a pointer in a particular circumstance.

Here is an incomplete list what pointers are used for:

  • dynamic allocation (new T)
  • recursive data structures (struct T { T* next; /* ... */ };)
  • iterators over arrays (for (T* p = &a[0]; p != &a[0] + n; ++p) { ... })
  • shared access to objects (T* new_pointer = existing_pointer;)
  • subtype polymorphism (T* pointer_to_base = pointer_to_derived;)
  • legacy call by reference (mutate(&object);)
  • optional types (if (p) { /* ... */ })

Note that using a single mechanism for all of these concepts demonstrates both the power and elegance for the experienced programmer and the great confusion potential for someone new to programming.

Source Link
fredoverflow
  • 7k
  • 9
  • 42
  • 46

Why did the C master Dennis Ritchie introduce pointers in c?

Because pointers are a very powerful mechanism that can be used in many ways.

And why did the other programming languages like vb.net or java or c# eliminate them?

Because pointers are a very dangerous mechanism that can be misused in many ways.

I think programmers should learn about pointers, but from an educational perspective, it is unwise to introduce them early. The reason is that they are used for so many different purposes, it's hard to tell as a beginner why you are using a pointer in a particular circumstance.

Here is an incomplete list what pointers are used for:

  • dynamic allocation (new T)
  • recursive data structures (struct T { T* next; /* ... */ };)
  • iterators over arrays (for (T* p = &a[0]; p != &a[0] + n; ++p) { ... })
  • shared access to objects (T* new_pointer = existing_pointer;)
  • subtype polymorphism (T* pointer_to_base = pointer_to_derived;)
  • legacy call by reference (mutate(&object);)
  • optional types (if (p) { /* ... */ })

Note that using a single mechanism for all of these concepts demonstrates both the power and elegance for the experienced programmer and the great confusion potential for someone new to programming.