File: structs.c

package info (click to toggle)
c2hs 0.28.8-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 1,772 kB
  • sloc: haskell: 6,882; ansic: 1,857; xml: 1,411; makefile: 112
file content (45 lines) | stat: -rwxr-xr-x 697 bytes parent folder | download | duplicates (9)
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
#include <stdlib.h>

#include "structs.h"

point make_point (int x, int y)
{
  point pnt;

  pnt = (point) malloc (sizeof (*pnt));
  pnt->x = x;
  pnt->y = y;
  return pnt;
}

weird make_weird (void)
{
  weird w;

  w = (weird) malloc (sizeof (*w));
  w->b = ' ';
  w->x = -1;
  w->nested.y   = 4;
  w->nested.z   = 2;
  w->nested.pnt = make_point (100, 200);
  return w;
}

mychar *getSpacePtr (void)
{
  static char c = ' ';
  
  return &c;
}

struct bit_struct my_bit_struct;

struct bit_struct *get_bit_struct()
{
  my_bit_struct.c1             = '\0';
  my_bit_struct.bit            = 1;
  my_bit_struct.very_small_int = -1;
  my_bit_struct.c2             = '\0';

  return &my_bit_struct;
}