Instantly share code, notes, and snippets.

Embed
What would you like to do?
#include <stdio.h>
typedef struct {
char *name;
int age;
} Person;
void person_info(Person person)
{
printf("%s, %i\n", person.name, person.age);
}
int main(int argc, const char *argv[])
{
Person person = {"James Newton", 21};
person_info(person);
return 0;
}
class Person
attr_accessor :name, :age
def initialize(name, age)
self.name = name
self.age = age
end
def info
puts "#{self.name}, #{self.age}"
end
end
person = Person.new('James Newton', 21)
person.info
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment