---
title: "size of array"
author: "standalone"
date: "2017-08-06T22:53:32Z"
tags: []
categories: ["编程语言"]
slug: "size-of-array"
draft: false
lastmod: "2017-08-06T22:53:32Z"
id: 2388483
url: "https://standalone.iteye.com/blog/2388483"
---

```c

#define num(x) (sizeof (x) / sizeof (*x))

int main(){

   int number[10] = {1,1,1,1,1,1};
   char *teststr[20] = {"","","","","","","","",""};

   printf("Size of number[10] is %d\n", (int)num(number));
   printf("Size of teststr[20] is %d\n", (int)num(teststr));
   return 0;
}

```