2011|08|
2013|10|11|12|
2014|01|02|03|04|05|06|07|08|09|10|11|12|
2015|01|02|03|05|06|07|08|09|10|11|12|
2016|01|03|04|05|06|07|08|09|10|11|12|
2017|01|02|03|04|05|06|07|08|09|10|11|12|
2018|01|02|03|04|05|06|07|08|09|10|11|12|
2019|01|02|03|04|05|06|07|08|09|10|11|12|
2020|01|02|03|04|

2017-04-12 structの中でもメソッドが動くことを確認 [長年日記]

/*
  g++ -g struct.cpp -o struct
 
*/
 
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
 
typedef struct bus_od{
  int a;
 
  int func(){
    int b = a + 1;
    return b;
  };
 
} BUS_OD;
 
 
int main()
{
  BUS_OD *new_p_bus_od = (BUS_OD *)malloc(sizeof(BUS_OD));
 
  new_p_bus_od->a = 3;  
  int c = new_p_bus_od->func();
 
  printf("c=%d\n",c);
 
  return 0;
}