Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9102831
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T01:28:35+00:00 2026-06-17T01:28:35+00:00

When I decided to teach myself to program, I started with Java. And although

  • 0

When I decided to teach myself to program, I started with Java. And although I’m familiar with writing simple procedural software (mostly in PHP), I’ve recently come to realize that for more complex operations I rely on objects.

My first Java game spawned opponents at random locations and with random speeds by instantiating objects. I am puzzled by the concept of implementing this procedurally in C (which I have very little working knowledge of), but I could only think of creating different arrays for the variables in each opponent and using the array indices as pseudo-object reference ‘variables’.

int size[50]; // opponent size
for (i = 0; i < 100; i++) {
    size[i] = random_number();
}

Is there a simple solution that my object-oriented mind has overlooked? Or do certain problems really lend themselves to object-oriented concepts to the extent that you have to make up fake objects (or at least use similar models)? I see structs in C code all the time, and I know they’re similar to classes in concept, but that’s all I know. So I’m wondering if stuff like this is possible with a totally non object-oriented mindset. There’s no real substitute for instantiation, is there? It’s all just allocation of memory, so the way I see it, certain C programs have no choice but to be written using some form of what I consider objects.

Please tell me I’m overlooking something, because otherwise I can’t respect C purists who berate the object-oriented paradigm. (I’m by no means an OO nut; my mind has become very accustomed to the idea, though, and it’s hard to see things through a different lens that doesn’t offer what you’re used to.)

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T01:28:37+00:00Added an answer on June 17, 2026 at 1:28 am

    If we neglect all advanced object oriented programming concepts, as inheritance or polymorphism by type parameters everything boils down to the same thing.

    In C++ you have objects and you call methods that are attached to them, in C you have structs and you call global functions by passing these functions by argument.

    What I mean is that the essential oop paradigm is conceptually to have objects which are able to perform things through their methods. Now in C you can obtain the same behavior but you have functions which are not attached to any object.

    So basically in C++ or Java you would have:

    class Point {
      private:
        int x, y;
      public:
        Point(int x, int y) : x(x), y(y) { }
        void draw() { ... }
    };
    

    In pure C you would have:

    struct Point {
      int x, y;
    }
    
    struct Point makePoint(int x int y) {
      struct Point p = {.x = x, .y = y};
      return p;
    }
    
    void drawPoint(struct Point p) {
      ..
    }
    

    But the semantic power of both representation is essentially the same, the syntax is different though (and even the concept behind it). Of course everything changes if we start considering more powerful oop features.

    In many circumstances you don’t need all this power to represent objects, not everything is meant to be oop neither all problems are best solved with an oop approach. If writing a complex engine for a game in C would be overkill at the same time writing low level functions in Java which operates with the system would be overkill at the same time.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

To teach myself a little C++, I decided to write a little Program to
Coming from Java Land I have been trying to teach myself Scala. Recently I
I've decided to teach myself how to program android apps, and so got the
I decided to teach myself assembly language. I have realized that my program will
I decided to teach myself how to use Parsec , and I've hit a
I have been trying to teach myself Regexes in python and I decided to
I'm currently trying to understand how the stack works, so I've decided teach myself
I am trying to teach myself LINQ to SQL and have decided to do
I've decided to teach myself Haskell and I have never been so frustrated in
Well, simple situation. I happen to be a software engineer who uses mostly Delphi

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.