[ create a new paste ] login | about

Link: http://codepad.org/QWeV2vpe    [ raw code | output | fork | 1 comment ]

joshua_cheek - C, pasted on Nov 1:
#include <stdio.h>

int main()
{
  typedef struct { char* chars; } string;  

  typedef string Table1;
  typedef string Table2;
  
  string a = {"abc"};
  Table1 x,y;
  
  Table2 z;
  Table2 w;

  x = y = z = w = a;
  
  printf( "%s %s %s %s\n" , w.chars,
                            x.chars,
                            y.chars,
                            z.chars);
  
  return 0;
}


Output:
1
abc abc abc abc


Create a new paste based on this one


Comments:
posted by joshua_cheek on Nov 15
Shows that typedefs in C retain name equivalence.
reply