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

  • SEARCH
  • Home
  • 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 1040253
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T15:12:03+00:00 2026-05-16T15:12:03+00:00

I have never programmed in C and have not programmed in C++ for a

  • 0

I have never programmed in C and have not programmed in C++ for a little while and either way, I am still learning.

I am writing a program in C and am converting a MATLAB program to this C program. I have a lot of variables from MATLAB that are cartesian coordinates, X Y Z, of points. Is there a variable type I could use built into C? I need to subtract different points and also do other operations on them. Any suggestions?

Thanks,
DemiSheep


Edit:

Ok I have another question. I want to make sure this is a good idea. (But first, with stackoverflow is this how I should post more information to my post, by editing my original post? -Thanks!)

Question:

I have an object with several characteristics. Say it’s a car and the car has several different parameters.

Parameters:

Position on map
Altitude (sea level?)
Start position
End Position

Can I use a struct or union (or both?) to have all these parameters inside the car “object” and update the parameters in the object like you would if it was it’s own class in like C++ or Java?

Like if I want to calculate the distance the car traveled from the start position to its current position in like a Cartesian plane I could do something like:

distantTraveled = car.position – car.startPosition

Thanks,
DemiSheep

  • 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-05-16T15:12:03+00:00Added an answer on May 16, 2026 at 3:12 pm

    There are no built-in types that will do what you want.

    You’ll probably have to make your own small struct type such as the following.

    typedef struct {
      double x, y, z;
    } coordinate;
    

    If you’re limited to C (rather than C++), you’ll then need to build up a small library of functions to operate on these data types.

    For what it’s worth, I highly recommend looking around to find a library that will provide this type of thing for you. Ideally something specialized to the domain you’re working in.

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

Sidebar

Related Questions

I am amateur programmer learning how to program. I have never had any computer
I have to ask this question because I've never programmed except in an intro
I have never programmed a gadget for Vista or Seven, but I would like
I have never programmed in visual basic before and my boss just told me
I have never come across this issue but most recently I noticed that a
I have never thought about until recently, but I'm not sure why we call
I'm writing a little Java program (it's an ImageJ plugin, but the problem is
I've never programmed in java or eclipse before, although I have used c# and
I have never programmed VB, but a university course forcibly requires me to use
1st of all: I'm not a programmer, never learnt programming/algorithms. Actually I have to

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.