mirror of
https://github.com/ziglang/zig.git
synced 2024-12-04 02:48:50 +00:00
26 lines
412 B
C
26 lines
412 B
C
#include <assert.h>
|
|
#include <stdio.h>
|
|
|
|
typedef struct {
|
|
int val;
|
|
} STest;
|
|
|
|
int getVal(STest* data) { return data->val; }
|
|
|
|
int main (int argc, char *argv[])
|
|
{
|
|
STest* data = (STest*)malloc(sizeof(STest));
|
|
data->val = 123;
|
|
|
|
assert(getVal(data) != 456);
|
|
int ok = (getVal(data) == 123);
|
|
|
|
if (argc>1) fprintf(stdout, "val=%d\n", data->val);
|
|
|
|
free(data);
|
|
|
|
if (!ok) abort();
|
|
|
|
return 0;
|
|
}
|