classes in ANSI C?

Ok, so I have been using the Arduino IDE to program for different projects, but I wanted to switch to good old fashioned C instead of the C++ that the IDE tends to use(yes, I understand that C++ will take C functions). I've been reading that C is the preferred language for AVRs and I'm trying to figure how how to use classes in C. I know that classes are for C++, and construct is for C, but what I'm trying to figure out is how to do something similar to class without using C++.

I should add that I'm using Eclipse with a USBtinyISP now to fool around with C and programming with it. I don't have much knowledge in programming and I'm beginning to lose interest in the books I've begun to read, as I feel like there is a LOT of stuff I just will never use in AVR programming, or will use so seldomly I'd rather tackle it at the time I need it.

So, can anyone help me out with that?

I'm trying to figure how how to use classes in C

You can't. Classes are C++ features.

I know that classes are for C++, and construct is for C,

No. structs are for C.

but what I'm trying to figure out is how to do something similar to class without using C++.

Why?

PaulS:
You can't. Classes are C++ features.

Exactly.

No. structs are for C.

Yes, after you mentioned that, I remembered it was struct. Thank you.

but what I'm trying to figure out is how to do something similar to class without using C++.

Why?

Well, I wrote some libraries for a specific arduino project, but I wanted to convert it to C so I could use it within Eclipse and the AVR plugin. I was hoping there was something similar to a class in C so it would be a pretty simple fix.

Would I just have to create each function I wanted within a source file and the function name(so to speak, you know, the typical...) in the header file?

The Eclipse AVR plugin uses the very same avr-gcc toolchain that Arduino uses (maybe a different version, but the same tool). Just use C++, it will compile.

Good to know. I wasn't sure if that was the case. Thank you.

Would I just have to create each function I wanted within a source file and the function name(so to speak, you know, the typical...) in the header file?

A library, to use Arduino's terminology, is a header file and a source file. The functions are declared in the header file, and implemented in the source file. The header file may, or may not, include the class construct. The source file may be a CPP file or it may be a C file.

If it is a CPP file, it can contain one or more class implementations.

The closest thing to a C++ Class in C is a struct containing a set of pointers to functions. You pretty much have to make the functions have a wide scope, though. And pointers to functions are not for the faint of heart.

westfw:
The closest thing to a C++ Class in C is a struct containing a set of pointers to functions. You pretty much have to make the functions have a wide scope, though. And pointers to functions are not for the faint of heart.

Pointers in general. I've read three books on the subject and still barely grasp them. Where to put the *(smash?) throws me off all the time. I think I at least have a better grasp of it than I did before I started learning about them, but they are definitely a struggle. That why I want to get away from Arduino though, because I want to actually know and understand what's going on behind the scenes.

Beginning C for Arduino has two chapters devoted to understanding and using pointers. You can read some of the book at Amazon.com and clicking on Look Inside on the book's cover.

econjack:
Beginning C for Arduino has two chapters devoted to understanding and using pointers. You can read some of the book at Amazon.com and clicking on Look Inside on the book's cover.

Thanks. I think I have that book, I don't remember. I've downloaded everything I can get my hands on for both Arduino and C. But thank you, I'll go check that one out.