Passion/Programming

Struct 초기화 하기

sunshout 2007. 6. 27. 23:09

struct 초기화 예제 (Language : c)
  1. #include <stdio.h>
  2.  
  3. struct student {
  4.     int a;
  5.     int b;
  6. };
  7.  
  8. main() {
  9. struct student mystudent = {a:1};          // a값만 초기화 하고 싶을때
  10. struct stduent mystudent1 = {.a=1};        // a값만 초기화 하고 싶을때(리눅스에서)
  11. }
  12.