﻿# Is size\_t a standard type in C\+\+? And in C?

size\_t is a base unsigned integer memsize\-type defined in the standard library of C/C\+\+ languages\. This type is described in the header file stddef\.h for C and in the file cstddef for C\+\+\. Types defined by the header file stddef\.h are located in the global namespace while cstddef places the size\_t type in the namespace std\. Since the standard header file stddef\.h of the C language is included into C\+\+ programs for the purpose of compatibility, in these programs you may address the type both in the global namespace \(::size\_t, size\_t\) and namespace std \(std::size\_t\)\.

Note that the size\_t type is not a reserved word of C/C\+\+ languages and is defined through the typedef specifier in the standard header file as a type of the result returned by the sizeof operator and is chosen so that it could store the maximum size of a theoretically possible array of any type, i\.e\. size\_t will be 32\-bit on a 32\-bit system and 64\-bit on a 64\-bit one\.

## References

1. Discussion at stackoverflow\.com\. [Is size\_t only in C\+\+ standard or C standard as well?](https://stackoverflow.com/questions/2547635/is-size-t-only-in-c-standard-or-c-standard-as-well)
1. Andrey Karpov, Evgeniy Ryzhkov\. [64\-bit lessons\. Lesson 5\. Building a 64\-bit application](https://pvs-studio.com/en/blog/lessons/0005/)
1. Discussion at stackoverflow\.com\. [Does "std::size\_t" make sense in C\+\+?](https://stackoverflow.com/questions/237370/does-stdsize-t-make-sense-in-c)
1. Knowledge Base\. [Is there a way to make the type size\_t 32\-bit in a 64\-bit program?](https://pvs-studio.com/en/blog/posts/cpp/k0021/)