This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Internal Function | |
*/ | |
#include <stdlib.h> | |
#include <stdio.h> | |
#include <string.h> | |
/* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "internal_api.h" | |
/* | |
data_t berupa struct yang dienkapsulasi | |
dan hanya bisa digunakan pada file ini | |
*/ | |
struct _data_t{ | |
int data1; | |
int data2; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
contoh sangat sederhana enkapsulasi data dengan c | |
more: https://deeprhezy.trumblr.com | |
compile: gcc -o penjumlahan penjumlahan.c internal_api.c | |
*/ | |
#include "internal_api.h" | |
int |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CC=gcc | |
CFLAGS=-I. | |
LDFLAGS= | |
FUNGSIOBJ = object.c\ | |
fungsiobj.c | |
all:object |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CC=gcc | |
CFLAGS=-I. | |
LDFLAGS= | |
FUNGSIOBJ = object.c\ | |
fungsiobj.c | |
all:object |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "object.h" | |
/* Melakukan pengalokasian memory, menggunakan calloc | |
Saat menggunakan fungsi ini direkomendasikan untuk | |
menghapus kembali memory menggunakan object_free() | |
*/ | |
object* | |
object_new(void){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef __OBJECT_H__ | |
#define __OBJECT_H__ | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
/* membuat pengelompokan data dengan struct | |
kita beri nama object yang berisi (object1 & object2) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "object.h" | |
int | |
main(int argc, char* argv[]) | |
{ | |
/* Deklarasi obj sebagai object */ | |
object* obj; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
This exmple program provides a trivial server program that listens for TCP | |
connections on port 9995. When they arrive, it writes a short message to | |
each client connection, and closes each connection once it is flushed. | |
Where possible, it exits cleanly in response to a SIGINT (ctrl-c). | |
*/ | |
/* Deklarasi lib standar yang digunakan */ | |
#include <string.h> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CC=gcc | |
CFLAGS=-I. | |
all: server_kalkulator | |
server_kalkulator: server_kalkulator.c | |
$(CC) $(CFLAGS) -o server_kalkulator $^ -L/usr/local/lib -levent -lm $(LDFLAGS) | |
clean: | |
rm -f *.o | |
rm -f *~ | |
rm -f server_kalkulator |
NewerOlder