Help - Search - Members - Calendar
Full Version: Trying to understand a C command
Linuxhelp > Support > Programming in Linux
docmur
Okay so I'm working on a project in my computer sci class at WCI and I need some help with C

first what does the command unsigned do here's how I'm using it

unsigned char *memcpy

second how do pointers work like what does it mean when I point unsigned char to memcpy anyway

Thank

DOCMUR
DS2K3
I would hazard a guess that it creates an unsigned (scalar) variable. ie no positive/negative sign, just the magnitude.

D
docmur
okay and what do pointers do
Geminias
unsigned just means a positive integer. by default if you declare say: int variable; the int is signed by default meaning it can contain values between negative 32000 and postive 32000 (something like that), but if you make it unsigned your advantage is you can have up to postive 64000 but your disadvantage is you can't have any negatives.

a pointer is a difficult concept for beginners to grasp and i'm not getting paid to explain it while there are programmers who have written books on C which have gotten paid. But essentially it is a type of variable that contains an address. The point of a pointer is to be able to access data stored on the heap after a function returns (after it goes out of scope) .
Hemant
By default...chars are basically signed integers, whose range is from -127 to +128..
So the first statement, creates a pointer "memcpy" that will point to a heap of unsigned characters.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2017 Invision Power Services, Inc.