﻿# Are the types size\_t and uintptr\_t equivalent?

The question if these types are equivalent and which of them and when should be used is discussed very much\. But in practice you may consider them equivalent and use them as you like\.

Usually the type [size\_t](https://pvs-studio.com/en/blog/terms/0044/) is used to emphasize that we deal with an object containing some size, number of elements or iterations\. The type [uintptr\_t](https://pvs-studio.com/en/blog/terms/0050/) is good for pointers\.

If you do not know what type to prefer, use typedef to define your own type representing the thing you are working with\.

## References

1. Stackoverflow\.com Discussion\. "[size\_t vs\. intptr\_t](https://stackoverflow.com/questions/1464174/size-t-vs-uintptr-t/1464194)"\.
1. Andrey Karpov\. [About size\_t and ptrdiff\_t](https://pvs-studio.com/en/blog/posts/cpp/a0050/)\.