Recent content by ladesidude
-
L
Can you explain the size difference between arrays and pointers in C?
i did use sizeof() and they all came back as 4, since the size of an int is 4 bytes and since its pointing to the first element in the array, I think. So its safe to say that they are not of the same size?- ladesidude
- Post #3
- Forum: Programming and Computer Science
-
L
Can you explain the size difference between arrays and pointers in C?
int* a1 = malloc(4 * sizeof(int)); int* a2 = malloc(3 * sizeof(int)); int* a3 = malloc(5 * sizeof(int)); a1[0] = 1; a1[1] = 2; a1[2] = 3; a1[3] = 4; a2[0] = 9; a2[1] = 8; a2[3] = 7; a3[0] = -1; a3[1] = -2; a3[2] = -3; a3[3] = -4; a3[4] = -5; My question: Are a1, a2 and a3 arrays? I...- ladesidude
- Thread
- Arrays Pointers
- Replies: 10
- Forum: Programming and Computer Science
-
L
Comparing Quicksort Approaches: Emp Struct vs Emp* Array
typedef struct Emp { unsigned char lname[MaxName + 1]; /* + 1 for '\0' */ unsigned char fname[MaxName + 1]; unsigned int id; unsigned char dept; bool married; } Emp; int comp1(const void* item1, const void* item2) { const Emp* emp1 = (const Emp*) item1; //emp1...- ladesidude
- Thread
- Comparison
- Replies: 1
- Forum: Programming and Computer Science
-
L
C/C++ C++ to Assembly: Convert, Interpret & Understand
Hi all, I have this small function in C++ void myfunc(int a, int b) { int c = 1; int d = 2; c += b; d += a; return; } the assembly code and my comments follow: subl $8, %esp ;; subtract 8 from %esp, what we are doing here is decrementing the stack pointer by 8 and...- ladesidude
- Thread
- Assembly C++
- Replies: 4
- Forum: Programming and Computer Science