Linked Questions

58 votes
10 answers
11k views

Recently, I came across the following statement: It's quite common for all pointers to have the same size, but it's technically possible for pointer types to have different sizes. But then I came ...
Richard's user avatar
  • 47k
0 votes
0 answers
1k views

So I have this array: fib BYTE 9, 123, 92, 0, 0, 0, 0 And I'm wanting to be able to access the different elements of the array and move them, individually, into a register. I've noticed so far ...
user3322166's user avatar
0 votes
1 answer
478 views

#include <stdio.h> int main() { printf("%ld", sizeof(void *)); return 0; } The output for the program was 8, but I am unable to figure out how.
pranava's user avatar
  • 33
-3 votes
1 answer
326 views

What is the size of pointers in c++? char a; char *b=a; cout<<sizeof(b); Output is 2 I don't know why. cout<<sizeof(const); //o/p is 2 cout<<sizeof(NULL); //o/p is 2
Himanshu Sharma's user avatar
0 votes
1 answer
105 views

I want to add a string after the struct in memory. How to check that i dynamically allocated right amount of bytes? Example: const wchar_t* add_str = L"test string"; struct test_{ ...
hgrev's user avatar
  • 135
16 votes
3 answers
722 views

I have a template that looks like this template <typename T> class Foo { public: Foo(const T& t) : _t(t) {} private: const T _t; }; Is there a savvy template metaprogramming way to ...
cppguy's user avatar
  • 3,761
7 votes
4 answers
3k views

I am confused as to how C pointers actually reference the memory address of a variable. I am probably missing something here, but if, for example an int is 32 bits (like in C), then this would be ...
Jr795's user avatar
  • 799
0 votes
7 answers
390 views

This may be a noob question ..but this is really confusing me.. Below is some sample code void main() { int a = 300; char *ptr = &a; int *intptr = &a; printf("%d\n %d\n", *...
TheGameiswar's user avatar
5 votes
2 answers
1k views

GCC gives me folowing warning: note: expected 'const void **' but argument is of type 'const struct auth ** Is there any case, where it could cause problems? Bigger snippet is struct auth *current; ...
KAction's user avatar
  • 2,017
1 vote
2 answers
2k views

I am trying to program a method that determines if a given number is an armstrong number. An armstrong number can be found by the steps below: Take base digits ie 456 => 4, 5, 6 Power to the number of ...
JShade01's user avatar
  • 153
1 vote
4 answers
394 views

I need some clarification on C++ memory allocation, I'll just get right to an example Let's say I have made a class A, which contains two containers: a hash_map and a std::vector like this: class ...
user2573715's user avatar
5 votes
1 answer
954 views

I came across this syntax for reading a BMP file in C++ #include <fstream> int main() { std::ifstream in('filename.bmp', std::ifstream::binary); in.seekg(0, in.end); size = in....
RBreight's user avatar
0 votes
4 answers
3k views

What is the size of a char*, or how would I be able to get the size of it? Would it simply be sizeof(char) or sizeof(char[]) I am asking this because I am trying to make a data structure (a queue) ...
SteamedBun's user avatar
5 votes
2 answers
756 views

In all books I've read until now, they said that C++ templates generate one instance of code for each type we use. On the other and, the books said that in C# the code is reused. So I made a ...
Adriaan's user avatar
  • 51
2 votes
2 answers
315 views

Of course int and long are not guaranteed to be the same type, but on a platform such as Windows when compiling in 32-bit mode where they happen to be the same size, is the compiler allowed to regard ...
rwallace's user avatar
  • 34.1k

15 30 50 per page