File: pointer.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 (32 lines) | stat: -rwxr-xr-x 487 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
#include <stdlib.h>
#include <stdio.h>

#include "pointer.h"

string concat (string str1, string str2)
{
  printf ("concat doesn't do anything");
  return str1;
}

Point *make_point (int x, int y)
{
  Point *pnt;

  pnt = (Point *) malloc (sizeof (Point));
  pnt->x = x;
  pnt->x = y;

  return pnt;
}

Point *trans_point (Point *pnt, int x, int y)
{
  Point *newPnt;

  newPnt = (Point *) malloc (sizeof (Point));
  newPnt->x = pnt->x + x;
  newPnt->y = pnt->y + y;

  return newPnt;
}