Starting To Program With C

closed account (zb0S216C)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include <stdio.h>
#include <memory.h>

struct f
{
    int *K;
};

void f_Constructor( int Init, f *This ) // Error here.
{
    if( This == NULL )
    {
        // Failed.
        return;
    }

    if( This -> K != NULL )
    {
        // Build the member.
        This -> K = ( int * )malloc( sizeof( int ) );
    }

    // Finished.
    return;
}

void f_Destructor( f *This )
{
    if( This == NULL )
    {
        // Failed.
        return;
    }

    if( This -> K != NULL )
    {
        // Delete the memory.
        free( This -> K );
        This -> K = NULL;
    }
}

int main( )
{
    printf( "This is my first solid C program.\n" );
    return 0;
}


Errors

expected deceleration specifiers or '...' before 'f'

Any ideas what this error means? Bare in mind that I haven't been programming in C for no more than 2 hours.
In C you need to write "struct f".
closed account (zb0S216C)
It worked :) Thanks, Zhuge.
Topic archived. No new replies allowed.