473,403 Members | 2,293 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

returning a char table (C)

What kind of function would I need to have to return a table that contains a string.

example:
int filltable(parameter){
char table[20] = {0};

return table[]
}
Jan 15 '07 #1
1 2728
Ganon11
3,652 Expert 2GB
Your return type could be string, but you would have to use the string class to build it instead of a character array. Otherwise, you can return a char pointer to the first element in your array. I'm pretty sure you can't return an actual array in C++.
Jan 15 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: John Galt | last post by:
I am writing a rudimentary shell. The (idealized) code is like this: /* read_cmd returns argv */ char **read_cmd(); shell() { char **cmd; while {
19
by: Rick | last post by:
Hi, I was wondering, can it be safely assumed that any function that returns a *char will return a NULL terminated string? Or does the function explicitly mention this always (and the ones that...
1
by: smen | last post by:
hiye, i use sqlcommand.executescalar to insert datainto my table hoping that it will return the table id, but its not :(. can someone uot there tell mehows its done? thanks in advance.
4
by: sk | last post by:
I'm trying to write a little function that acts very similar to scanf, but I suck at pointers and returning chars. My code: char *getline(){ char *string; char c; int i=0;...
19
by: Robert Smith | last post by:
I am wondering why it is possible to return a pointer to a string literal (ie. 1) but not an array that has been explicitly allocated. (ie. 2) ? Both would be allocated on the stack, why does the...
5
by: noridotjabi | last post by:
Why is it not possible to return char** from a funcion. For example: char** foo(void) { char foobar = {"foo", "bar"}; return foobar; } int main(void) { printf("%s\n", foo());
7
by: Joey Sabey | last post by:
Hey, I've got a bit of a strange problem caused by a situation I'm in. I'm writing a DLL for a friend of mine in C++, and he plans to use it in delphi. The DLL needs to return strings, and we doubt...
0
by: rkpatil | last post by:
have an unmanaged C++ DLL with following method: the DLL interface for unmanaged C++ is: SendCommand(void *h, char *c, char *d, char *b); the declaration in C# is: unsafe public static...
5
by: mehafi | last post by:
Hi, Why this program work? #include<iostream.h> class test { public: char *ptr; void setPtr(char* p){
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.