// filename:c2011-6-5-3-4-ex.c
// original examples and/or notes:
// 		(c) ISO/IEC JTC1 SC22 WG14 N1570, April 12, 2011
// http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf
// 			C2011 6.5.3.4 The sizeof and _Alignof operators
// compile and output mechanism:
// 		(c) Ogawa Kiyoshi, kaizen@gifu-u.ac.jp, December.xx, 2013
// compile errors and/or wornings:
// 1	(c) Apple LLVM version 4.2 (clang-425.0.27) (based on LLVM 3.2svn)
// 			Target: x86_64-apple-darwin11.4.2 //Thread model: posix
// 		(c) LLVM 2003-2009 University of Illinois at Urbana-Champaign.
// 2    gcc-4.9 (GCC) 4.9.0 20131229 (experimental)
//      Copyright (C) 2013 Free Software Foundation, Inc.
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
// #include <malloc.h>
// #include <alloc.h>

void * alloc(size_t st){
return (void *)malloc(sizeof st);
}

//Example3
#include <stddef.h>
size_t fsize3(int n)
{
char b[n+3]; // variable length array
return sizeof b; // execution time sizeof
}
int main(void)
{
size_t size;
size = fsize3(10);
printf("%d \n",(int) size ); // fsize3 returns 13

// Example2
int array [1];
printf("%ld \n",sizeof array / sizeof array[0]);

// Example 1
extern void *alloc(size_t);
double *dp = alloc(sizeof *dp);
printf("6.5.3.4 The sizeof and _Alignof operators %f",*dp );
return 0;
}
// output LLVM 3.2& GCC 4.9
// 13 
// 1 
// 6.5.3.4 The sizeof and _Alignof operators 0.000000