Les Partages de Memiks
Tag cloud
Picture wall
Daily
RSS Feed
  • RSS Feed
  • Daily Feed
  • Weekly Feed
  • Monthly Feed
Filters

Links per page

  • 20 links
  • 50 links
  • 100 links

Filters

Untagged links
page 6 / 155
getting size of array from pointer c++ - Stack Overflow https://stackoverflow.com/questions/19894686/getting-size-of-array-from-pointer-c/19894884
Sat Feb 6 14:03:38 2021 archive.org
QRCode
thumbnail

C++ is based on C and inherits many features from it. In relation to this question, it inherits something called "array/pointer equivalence" which is a rule that allows an array to decay to a pointer, especially when being passed as a function argument. It doesn't mean that an array is a pointer, it just means that it can decay to one.

void func(int ptr); int array[5]; int ptr = array; // valid, equivalent to 'ptr = &array[0]' func(array); // equivalent to func(&array[0]);

This last part is the most relevant to your question. You are not passing the array, you are passing the address of the 0th element.

In order for your function to know how big the incoming array is, you will need to send that information as an argument.

static const size_t ArraySize = 5; int array[ArraySize]; func(array, ArraySize);

Because the pointer contains no size information, you can't use sizeof.

void func(int* array) { std::cout << sizeof(array) << "\n"; }

This will output the size of "int*" - which is 4 or 8 bytes depending on 32 vs 64 bits.

Instead you need to accept the size parameters

void func(int* array, size_t arraySize); static const size_t ArraySize = 5; int array[ArraySize]; func(array, ArraySize);

Even if you try to pass a fixed-sized array, it turns out this is syntactic sugar:

void func(int array[5]);

http://ideone.com/gaSl6J

Remember how I said that an array is NOT a pointer, just equivalent?

int array[5]; int* ptr = array; std::cout << "array size " << sizeof(array) << std::endl; std::cout << "ptr size " << sizeof(ptr) << str::endl;

array size will be 5 sizeof(int) = 20 ptr size will be sizeof(int ) which will be either 4 or 8 bytes.

sizeof returns the size of the type being supplied, if you supply an object then it deduces the type and returns the size of that

If you want to know how many elements of an array are in the array, when you have the array and not a pointer, you can write

sizeof(array) / sizeof(array[0])

or sizeof(array) / sizeof(*array)

cpp pointer sizeof memory
Dynamic Allocation in Classes https://www.cs.fsu.edu/~myers/cop3330/notes/dma.html
Sat Feb 6 14:01:18 2021 archive.org
QRCode
cpp memory alloc
I2C Bus for ATtiny and ATmega : 8 Steps - Instructables https://www.instructables.com/I2C_Bus_for_ATtiny_and_ATmega/
Wed Feb 3 07:13:03 2021 archive.org
QRCode
I2C bus atmega
GitHub - lupyuen/bl_iot_sdk: BL602 SDK (Pine64 fork plus enhancements) https://github.com/lupyuen/bl_iot_sdk
Sun Jan 31 15:54:53 2021 archive.org
QRCode
thumbnail

BL602 SDK (Pine64 fork plus enhancements). Contribute to lupyuen

bl602 risc-v dtbl10
DT-BL10 - Low-Power IoT Development Board Powered by RISC-V Core - Electronics-Lab.com https://www.electronics-lab.com/dt-bl10-low-power-iot-development-board-powered-by-risc-v-core/
Sun Jan 31 07:56:24 2021 archive.org
QRCode
thumbnail

DT-BL10 is a development board powered by BL602 WiSoC that sells for around $5. This board...

risc-v bl602 dt-bl10
BL602 IoT SDK and $5 DT-BL10 WiFi & BLE RISC-V development board https://www.cnx-software.com/2020/10/25/bl602-iot-sdk-and-5-dt-bl10-wifi-ble-risc-v-development-board/
Sun Jan 31 07:55:52 2021 archive.org
QRCode
thumbnail

Resources to get started with Bouffalo BL602 RISC-V IoT MCU include the BL602 IoT SDK and DT-BL10 WiFi & Bluetooth development board.

risc-v bl602 dt-bl10
Calibrating pen and touch via xinput - Unix & Linux Stack Exchange https://unix.stackexchange.com/questions/229908/calibrating-pen-and-touch-via-xinput
Thu Jan 28 20:10:39 2021 archive.org
QRCode
thumbnail
[SOLVED] Touchscreen calibration fails - Linux Mint Forums https://forums.linuxmint.com/viewtopic.php?t=108973
Thu Jan 28 20:09:51 2021 archive.org
QRCode
Contributing to KDE is easier than you think – Bug triaging – rabbiticTranslator https://rabbitictranslator.com/wordpress/index.php/2021/01/28/contributing-to-kde-bug-triaging/
Thu Jan 28 19:01:19 2021 archive.org
QRCode
kde bug contribute
Contourner les paywall + astuce pour vos scripts - Le Hollandais Volant https://lehollandaisvolant.net/?d=2021/01/25/18/31/26-contourner-les-paywall-astuce-pour-vos-scripts
Tue Jan 26 06:38:02 2021 archive.org
QRCode
thumbnail

De plus en plus de sites sont en AJAX même pour les pages les plus simples. Comprendre : la page envoyée par le serveur au navigateur est vide, et ne contient qu’un script. C’est le script qui va récupérer — dans un second temps — les données de …

paywall âme diable
Buffers — The Linux Kernel documentation https://www.kernel.org/doc/html/latest/driver-api/iio/buffers.html
Sun Jan 24 13:41:57 2021 archive.org
QRCode
libiio-matlab/libiio_if.m at master · analogdevicesinc/libiio-matlab · GitHub https://github.com/analogdevicesinc/libiio-matlab/blob/master/libiio_if.m
Sun Jan 24 13:41:00 2021 archive.org
QRCode
thumbnail
What is the Wayland equivalent of xinput list? - Unix & Linux Stack Exchange https://unix.stackexchange.com/questions/426944/what-is-the-wayland-equivalent-of-xinput-list
Sun Jan 24 08:47:06 2021 archive.org
QRCode
thumbnail
Iconduck - Free open source icons, illustrations and graphics https://iconduck.com/
Sun Jan 24 07:45:37 2021 archive.org
QRCode
thumbnail
How to Change Mouse and Touchpad Settings Using Xinput in Linux – Linux Hint https://linuxhint.com/change_mouse_touchpad_settings_xinput_linux/
Sat Jan 23 17:43:14 2021 archive.org
QRCode
How to Change Mouse and Touchpad Settings Using Xinput in Linux – Linux Hint https://linuxhint.com/change_mouse_touchpad_settings_xinput_linux/
Sat Jan 23 17:43:14 2021 archive.org
QRCode
src - xorg/app/xinput - xinput is a small commandline tool to configure devices. (mirrored from https://gitlab.freedesktop.org/xorg/app/xinput) https://cgit.freedesktop.org/xorg/app/xinput/tree/src
Sat Jan 23 17:41:00 2021 archive.org
QRCode
Tout ce que j'aurais aimé qu'on me dise la première fois que j'ai appris le C — rendez-vous sur ArraKISS https://ybad.name/log/2021-01-20.html
Fri Jan 22 08:08:42 2021 archive.org
QRCode
Blue Pill Vs Black Pill: Transitioning From STM32F103 To STM32F411 | Hackaday https://hackaday.com/2021/01/20/blue-pill-vs-black-pill-transitioning-from-stm32f103-to-stm32f411/
Thu Jan 21 09:59:43 2021 archive.org
QRCode
thumbnail
http://hantek.com/uploadpic/hantek/files/20210113/DSO2000%20Series%20Digital%20Storage%20Oscilloscope%20User%20Manual%20V1.3.pdf http://hantek.com/uploadpic/hantek/files/20210113/DSO2000%20Series%20Digital%20Storage%20Oscilloscope%20User%20Manual%20V1.3.pdf
Wed Jan 20 21:48:01 2021 archive.org
QRCode
hantek oscilloscope electronique
page 6 / 155
4959 links, including 1865 private
Shaarli - The personal, minimalist, super-fast, database free, bookmarking service by the Shaarli community - Theme by kalvn