| | |
Preferred way to pass a string
![]() |
•
•
Join Date: Sep 2008
Posts: 6
Reputation:
Solved Threads: 0
as a pointer
you don't have to pass it back, because the calling function already knows the pointer
of course, you may always pass back a pointer, if for example you are doing a search for a substring.
you don't have to pass it back, because the calling function already knows the pointer
of course, you may always pass back a pointer, if for example you are doing a search for a substring.
newsreports.org - 5 second website check
basicstate.com - free website uptime monitor and alert service
edgedirector.com - managed dns global loadbalance and failover service
basicstate.com - free website uptime monitor and alert service
edgedirector.com - managed dns global loadbalance and failover service
Passing back the original pointer is sometimes also used so that the function can be a nested function call. Example:
C Syntax (Toggle Plain Text)
const char* foo(char *ptr) { ... <snip> return ptr; } int main() { printf("%s\n", foo("How now brown cow.")); }
The most important thing in the Olympic Games is not to win but to take part, just as the most important thing in life is not the triumph but the struggle. The essential thing is not to have conquered but to have fought well.
-Pierre de Coubertin, The Olympic Creed Inspired by Bishop Ethelbert
-Pierre de Coubertin, The Olympic Creed Inspired by Bishop Ethelbert
![]() |
Similar Threads
- Set up router password (Network Security)
- generating dynamic/runtime query (JSP)
- How to be Crash Free (C++)
Other Threads in the C Forum
- Previous Thread: Looking for some help
- Next Thread: Some simple questions...
Views: 990 | Replies: 3
| Thread Tools | Search this Thread |
Tag cloud for C
api array arrays bash behaviour binary binarysearch c++ calculator char code coke command conversion convert copyanyfile copypdffile createprocess() database decimal directory dude dynamic error exec fflush(stdout) fgets file files fork function functions getlogicaldrivestrin givemetehcodez grade graphics homework i/o ide input int integer interest kilometer lazy library line linked linkedlist linux list locate loop malloc matrix memory meter mysql no-code no-effort operator output path pause pointer pointers problem process program programming read recursion recursive recv refresh reverse roman scanf segmentationfault sms_speak socketprograming socketprogramming spoonfeeding strchr string strings strtok structures student suggestions syntax system test turbo-c turboc unix user variable win32api windows






