When using malloc and doing similar memory manipulation can I rely on sizeof( char ) being always 1?
For example I need to allocate memory for N elements of type
Something else to keep in mind is that the compiler statically knows the value of sizeof (char) is 1 and it also knows that multiplying a number by a static 1 implies the multiplication doesn't need to be done; the compiler will optimize it out. Concerns of performance shouldn't enter in to consideration on these grounds.