Hi
I've been using C++ quite a lot now, but i have recently moved over to C, and because of my experience with C++ i tend to use C in the same way as I used C++.
e.g:
[code=c]
typedef struct SMyStruct
{
int A,B,C;
} MyStruct;
int myStruct_set_va lues(MyStruct* s, int a, int b, int c)
{
s->A = a;
s->B = b;
s->C = c;
}
[/code]
I feel that I'm using C the wrong way, as I'm really creating objects and member functions.
Is the above code following conventions?
If not, how would you do it?
I've been using C++ quite a lot now, but i have recently moved over to C, and because of my experience with C++ i tend to use C in the same way as I used C++.
e.g:
[code=c]
typedef struct SMyStruct
{
int A,B,C;
} MyStruct;
int myStruct_set_va lues(MyStruct* s, int a, int b, int c)
{
s->A = a;
s->B = b;
s->C = c;
}
[/code]
I feel that I'm using C the wrong way, as I'm really creating objects and member functions.
Is the above code following conventions?
If not, how would you do it?
Comment