이름을 출력해보자

Malman Bunzirr·2022년 7월 4일
0

목표

나는 방금 C언어를 공부했어.
Hello, World!는 이미 출력했으니까... 내 이름을 출력하는 프로그램을 만들어보자!

코드

// info.h

#define NAME "JH"

typedef struct _Person{
    char name[10];
    int age;
    float height;
} Person;

void printName(Person *person){
    printf("My name is %s", person->name);
}
/*
Written by : JH.Kim
Purpose : This program prints out my name to the screen.
Date : 2022-07-04
*/

/***************************
 *  PROGRAMMING IS FUNNY!  *  
***************************/

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

int main(){
    Person ME = {.name=NAME, .age=20, .height=169.8};
    // This code is displaying my name
    printName(&ME);
    return 0;
}

출력 결과

My name is JH

0개의 댓글