|
| ||||||||||
| Tags: c library, declare function, function, string |
![]() |
| | Thread Tools | Search this Thread |
|
#1
| ||||
| ||||
| Return string from a function in C
|
|
#2
| ||||
| ||||
| Re: Return string from a function in C Code: # include <stdio.h> char * function () ( char * str = "test"; return str; ) int main () ( printf ( "% s \ n", function ()); return 0; ) |
|
#3
| |||
| |||
| Re: Return string from a function in C
In the C API, certain functions return a string as a parameter. Each of these functions uses the same interface for retrieving a string. msStringProperty() is a pointer to a buffer provided by the application into which XMS copies the characters in the string. |
|
#4
| ||||
| ||||
| Re: Return string from a function in C
To return string from a function try this program : ex: Code:
#include
char * cfun(void);
main ()
{
printf("%s\n",cfun());
}
char * cfun(void)
{
char *name;
name = (char *)malloc(20*sizeof(char));
printf("Enter name\n");
scanf("%s",nme);
return(nme);
} |
![]() |
|
| Thread Tools | Search this Thread |
| |
Similar Threads for: "Return string from a function in C" | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| SSH return function | Elizabeth Allen | Networking & Security | 5 | 22-04-2010 02:38 PM |
| Is it possible for a function to return two values? | hounds | Software Development | 5 | 13-03-2010 06:51 PM |
| How can I return different class in one function? | Madaleno | Software Development | 4 | 10-02-2010 08:45 PM |
| How to return an array from function | Rilex | Software Development | 3 | 02-10-2009 09:18 AM |
| How to return a recordset from a function in ASP | Ananias | Software Development | 3 | 19-06-2009 11:35 PM |