Linked Questions

34 votes
13 answers
11k views

What makes more sense - char* string or char *string? [duplicate]

I'm learning C++ at the moment, and I'm coming across a lot of null-terminated strings. This has got me thinking, what makes more sense when declaring pointers: char* string or char *string ? To me, ...
Skilldrick's user avatar
  • 69.9k
23 votes
1 answer
16k views

Difference between char* var; and char *var;? [duplicate]

Just wondering if there's any difference between: char* var; char *var; or is it just a matter of preference (spacing)?
Joe DF's user avatar
  • 5,508
4 votes
7 answers
1k views

Does the position of the * or & matters? [duplicate]

Possible Duplicates: In C, why is the asterisk before the variable name, rather than after the type? What's your preferred pointer declaration style, and why? In C++, i see pointers put in ...
andrew's user avatar
  • 83
0 votes
5 answers
887 views

Whats the difference between void* and void * [duplicate]

Possible Duplicate: In C, why is the asterisk before the variable name, rather than after the type? Declaring pointers; asterisk on the left or right of the space between the type and name? I ...
Manikandaraj Srinivasan's user avatar
-1 votes
3 answers
2k views

The asterisk in Objective-C object instance declarations: by the Object or by the instance? [duplicate]

Possible Duplicate: What's your preferred pointer declaration style, and why? In C, why is the asterisk before the variable name, rather than after the type? What makes more sense - char* ...
MJN's user avatar
  • 10.8k
4 votes
4 answers
239 views

Does the position of an asterisk affect pointers? [duplicate]

I have noticed that in C++, a pointer can be declared using two different types of indentation (if that's the right word I'm looking for): //Space followed by asterisk with variable name char *...
Ben's user avatar
  • 1,309
2 votes
5 answers
301 views

Is it typical programming practice to put the asterisk in the pointers right before the name? [duplicate]

I've been doing this for a while: int* myIntPointer; string* myString1,* myString2; But I've noticed a lot of people do this: int *myIntPointer; string *myString1, *myString2; Which one is more ...
user2348979's user avatar
1 vote
1 answer
555 views

What is the rational for using char *ch vs char* ch [duplicate]

I most commonly see code with the pointer next to the variable name instead of the type. I originally preferred the later (·char* ch·) because to me it makes more sense that I am declaring the type ...
Nate's user avatar
  • 5,317
0 votes
2 answers
219 views

Difference between datatype* <variable name> vs. datatype *<variable name> [duplicate]

I studying how to create linked lists in C. Take a look at this article. First he creates the structure using the following code; struct node { int data; struct node *next; }; Its clear that *...
satnam's user avatar
  • 1,465
0 votes
4 answers
248 views

asterisk with typedef or var name [duplicate]

Is char* myString or char *myString considered best practice? My professor consistently uses char* myString and this seems to be less confusing than char *myString, but I've also seen many developers ...
Apollo's user avatar
  • 9,012
0 votes
1 answer
162 views

What is the difference between Object* myObject and Object *myObject [duplicate]

I don't own a book on C++ and cant afford one, and cant seem to find a decent post (or a good google result) regarding the topic. So what is the difference? and what would best practice be for writing ...
user avatar
-1 votes
1 answer
64 views

What is the significance of asterisks postfixing a variable type in a method header? [duplicate]

I have been trying to learn C as a programming language, and have been trying to solve sample problems on site like LeetCode in C programs. When I was reading over some of the skeleton code that was ...
Fuse's user avatar
  • 1
-2 votes
1 answer
104 views

Does it matter where you put the pointer? (asterix) sign? [duplicate]

I Just want to know what is the difference between the following way of assigning a pointer. i was watching a C tutorial online and couldn't understand why he used the second pointer like this char * ...
Madona wambua's user avatar
-2 votes
1 answer
95 views

Difference between pointer to data type and data member [duplicate]

I am learning C and I have difficulty in understanding difference between two statements which are pointers double **X; and double** X; Are both same? Also one more question. When do we ...
noob man's user avatar
0 votes
0 answers
32 views

The difference between "char* variable" and "char *variable" in C [duplicate]

I'm learning C and I'm wondering about the difference between writing type* variable and type *variable.
Laura's user avatar
  • 13

15 30 50 per page