About 92,400,000 results
Open links in new tab
  1. Returning a C string from a function - Stack Overflow

    Well, in your code you are trying to return a String (in C which is nothing but a null-terminated array of characters), but the return type of your function is char which is causing all the trouble …

  2. Strings in C - GeeksforGeeks

    6 days ago · Below, the common methods of reading strings in C will be discussed, including how to handle whitespace, and concepts will be clarified to better understand how string input works.

  3. How to return string from a function in C - byby.dev

    Jul 5, 2023 · There are different ways to return string from a function in C, but some of them are not recommended or have potential problems. Here are some common methods and their …

  4. How to Return a String from a C Function - tech-wiki.online

    In this blog post, we will explore how to return a string from a C function. Returning a string in C can be a bit tricky because strings are actually arrays of char elements.

  5. Demystifying String Returns in C Functions – TheLinuxCode

    However, strings have nuanced storage and memory management requirements that become especially important when returning string values from functions. In this comprehensive guide, …

  6. How To Return A String From A Function | C Programming Tutorial

    How to return a string from a function using C. Methods covered include returning a pointer to a string literal, using pass by reference (i.e. pass by pointer) to effectively "return"...

  7. Returning a String in C

    May 28, 2017 · Hello, I am here to show you how to return a string from a C function. Yes, really. Honestly, I spent more time trying to figure this out than I would like to admit. On the bright …

  8. Four methods of function returning string in C language

    Here are four ways to return a string: 1. Pass the string pointer as a function parameter and return the pointer. 2. Use malloc The function allocates memory dynamically, pay attention to release …

  9. c - Return char []/string from a function - Stack Overflow

    You need to use heap allocation like malloc for the string in your function in order for the pointer you return to have any meaning. Then you need to remember to free it later.

  10. Returning Strings

    Mar 19, 2025 · Working with strings in C requires a solid grasp of memory management and how data is passed into and out of functions. In this article, we explore different methods for …