Timeline for Difference between char and char* in c
Current License: CC BY-SA 4.0
9 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jun 17, 2023 at 16:06 | comment | added | David D. |
@DragosMakovei in the case of function parameters, char buffer[] and char *buffer are equivalent. According to section 5.3 of The C Programming Language by K&R, "we prefer the latter because it says more explicitly that the variable is a pointer."
|
|
S May 30, 2021 at 20:40 | history | suggested | CommunityBot | CC BY-SA 4.0 |
Add code formatting, fix typos and english langurge errors, clarify sentence structures
|
May 23, 2021 at 17:57 | review | Suggested edits | |||
S May 30, 2021 at 20:40 | |||||
Oct 27, 2019 at 20:06 | comment | added | Dragos Makovei |
If you have a function int getline(char buffer[]) vs int getline(char *buffer) in which you read the chars from the console one by one, adding them to the buffer variable which is declared in main as char inputLine[50] , which would be the difference? I have tried replace one prototype with the other and it does not change my program's functionality. I can still acces elements with the index buffer[idx] in either case!
|
|
Jul 21, 2019 at 2:49 | comment | added | Samuel Chan | was looking for a proper explanation with examples. This is the best i've seen so far. Thank you! | |
Jun 4, 2019 at 12:02 | comment | added | Sachin Bhandari |
@AntoineWood so you mean to say s in char s[]= "hello" is not just any variable, it's a structure variable?
|
|
Mar 1, 2019 at 23:30 | comment | added | ananvodo | I have look into so many places and this is by far the best explanation I have seen. thanks! | |
Dec 28, 2018 at 12:04 | vote | accept | Chinmay Shah | ||
Mar 23, 2015 at 1:44 | history | answered | Antoine Wood | CC BY-SA 3.0 |