Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

difference between int* i and int *i

Tags:

c

delphi

I'm converting a header file for a DLL written in C to Delphi so I can use the DLL.

My question is what is the difference between

int* i 

and

int *i 

I convert the first to

i: PInteger; 

But i'm not sure what the correct conversion is for the second one in Delphi.

from my understanding the first is a simple typed pointer. The second is a pointer variable. but i'm not sure what the difference is.

like image 243
Mike Taylor Avatar asked Sep 22 '10 14:09

Mike Taylor


People also ask

What is the difference between int * a and int * A?

There is no such difference in between these two types of array declaration. It's just what you prefer to use, both are integer type arrays. There is no difference in functionality between both styles of declaration. Both declare array of int.

What is the difference between int and int * in C?

int means a variable whose datatype is integer. sizeof(int) returns the number of bytes used to store an integer. int* means a pointer to a variable whose datatype is integer. sizeof(int*) returns the number of bytes used to store a pointer.

What is the difference between int * p and int * p?

They are the same. The first one considers p as a int * type, and the second one considers *p as an int .

What is int int * in C language?

int. Integers are whole numbers that can have both zero, positive and negative values but no decimal values. For example, 0 , -5 , 10. We can use int for declaring an integer variable.


1 Answers

As far as C goes they both do the same thing. It is a matter of preference. int* i shows clearly that it is an int pointer type. int *i shows the fact that the asterisk only affects a single variable. So int *i, j and int* i, j would both create i as an int pointer and j as an int.

like image 164
Kyle Avatar answered Oct 06 '22 01:10

Kyle