Skip to content

Instantly share code, notes, and snippets.

@leehambley
Created September 4, 2011 16:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leehambley/132db7594974e328dc7a to your computer and use it in GitHub Desktop.
Save leehambley/132db7594974e328dc7a to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <stdlib.h>
struct session_t {
int port;
char* host;
};
typedef struct session_t *SESSION;
void setup(SESSION s);
void print(SESSION s);
void teardown(SESSION s);
int main() {
SESSION s = (SESSION) malloc(sizeof(SESSION));
setup(s);
print(s);
teardown(s);
return EXIT_SUCCESS;
}
void setup(SESSION s) {
// s->port = 1024;
// s->host = "example.org";
}
void print(SESSION s) {
sprintf("%s:%d\n", s->host, s->port);
}
void teardown(SESSION s) {
free(s);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment