Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to initialize unsigned char pointer

I want to initialize an unsigned char * buffer of length 1500 so that I can store values in it from some other sources.

like image 863
Yatendra Avatar asked Sep 04 '25 01:09

Yatendra


1 Answers

If you want it on the heap,

unsigned char* buffer = new unsigned char[1500];

if you want it on the stack,

unsigned char buffer[1500];

like image 131
QuantumMechanic Avatar answered Sep 07 '25 10:09

QuantumMechanic