/* 
* Code Snippets for this week
* Small programs to show bits of C and bits of C. 
* >> I've tried to put * at the start of all the comment lines. 
*/

/*
* Example Interface / Header File (student.h) 
*/
#ifndef _EXAMPLE_H_
#define _EXAMPLE_H_

const int NAME_MAX = 32;

typedef struct Student
{
    char name[NAME_MAX];
    int mark;
};

void printStudent(Student s);
void fillStudent(Student *s);

#endif

/* 
* Example Implementation File (student.cpp)
*/

#include <stdio.h>
#include "student.h"

void printStudent(Student s)
{
    printf("%s is paid %d\n", s.name, s.mark);
}

void fillStudent(Student *s)
{
    scanf("%s", s->name);
    scanf("%d", &s->mark);
}

/* 
* Example Client File (main.cpp)
*/

#include <stdio.h>
#include <stdlib.h>
#include "student.h"

int main(char* argv, int argc)
{
    Student s;
    fillStudent(&s);
    printStudent(s);

    exit(0);
}

