Tags "pointers" Result

Pointers pointers.

I thought I could assign an array of chars to a pointer to pointer. However, when I do the following: #include <stdio.h> int main(void) { char buff[] ="test"; char **output = &buff; return 0; } I get: $gcc -g ptr.c -o ptr ptr.c: In function `main'': ptr.c:5: warning: initialization from incompatible pointer type What am I d

it1352 2 2019-06-25

Pointers, smart pointers or shared pointers?

I am programming with normal pointers, but I have heard about libraries like Boost that implement smart pointers. I have also seen that in Ogre3D rendering engine there is a deep use of shared pointers. What exactly is the difference between the three, and should I stick on using just a type of them? Solution Sydius outlined the types fairly well

it1352 1 2019-05-10

Pointers to pointers vs. normal pointers

The purpose of a pointer is to save the address of a specific variable. Then the memory structure of following code should look like: int a = 5; int *b = &a; ...... memory address ...... value a ... 0x000002 ................... 5 b ... 0x000010 ................... 0x000002 Okay, fine. Then assume that now I want to save t

it1352 1 2019-05-10

Pointers

I am realy confussed bout pointers.. Can you guys please tell me what is the difference or is there any kinds of pointers ? char** a; char *a; *char a; etc if there is any that i don''t know or i am wrong. Thanks Regards, Billy Solution On 8 Mar 2005 06:39:45 -0800, in comp.lang.c , "ByteSurfer" <by********@gmail.com> wrote: I

it1352 3 2019-06-25

Character pointers and integer pointers ( )

I have two pointers, char *str1; int *str2; If I look at the size of both the pointers let’s assume str1=4 bytes str2=4 bytes str1 will increment by 1 byte, but if str2 it will increment 4 bytes. What is the concept behind this? Solution Simple, in the provided scenario: char is 1 byte long int (in your platform) is 4 bytes long The

it1352 1 2019-05-10

Character pointers and integer pointers ( )

I have two pointers, char *str1; int *str2; If I look at the size of both the pointers let’s assume str1=4 bytes str2=4 bytes str1 will increment by 1 byte, but if str2 it will increment 4 bytes. What is the concept behind this? Solution Simple, in the provided scenario: char is 1 byte long int (in your platform) is 4 bytes long The

it1352 1 2019-05-11

Character pointers and integer pointers ( )

I have two pointers, char *str1; int *str2; If I look at the size of both the pointers let’s assume str1=4 bytes str2=4 bytes str1 will increment by 1 byte, but if str2 it will increment 4 bytes. What is the concept behind this? Solution Simple, in the provided scenario: char is 1 byte long int (in your platform) is 4 bytes long The

it1352 1 2019-05-11

C pointers vs. Objective-C pointers

I'm coming from an Objective-C background and am trying to expand my knowledge in C. One thing has me confused, however, and that's the difference between pointers in C and Obj-C. As you can see in the examples below, things seem to behave a bit differently between both languages, and I was wondering if you could help explain why? C code works f

it1352 3 2019-05-10

const qualifier for pointers to pointers

I'm having a bit trouble deducing what is const, when applied to pointers to pointers, etc. i.e., what is const when you have const Foo **foo; Can I here change something in **foo ? as in foo[0]->bar = 12; What about: const Foo ***foo; Foo **const foo; Solution You could use cdecl to understand what a C declaration means. const int **

it1352 3 2019-05-09

Why pointers?

Before I had a good idea how to use pointers, I was wondering - first, how to use them. And second, of what value would they be. Now that I have at least a pretty good idea of how to use them, I am still wondering of what real value are they? I''ll admit - its pretty sexy to be able to assign values indirectly, but what I''m trying to figue out i

it1352 1 2019-06-27