-2

Visual Studio shows me a error on auto**. Why?

My code:

auto** getMetaInfo(SQLHANDLE sqlStmtHandle)

{
    SQLCHAR colName[256];
    SQLSMALLINT colNameLen;
    SQLSMALLINT dataType;
    SQLSMALLINT numDecimalDigits;
    SQLSMALLINT allowsNullValues;
    SQLUINTEGER columnSize;
    SQLSMALLINT columns = getrows();
    auto retArray = new SQLCHAR[columns][2]();
    for (int i = 1; i <= columns; i++)
    {
        SQLRETURN  retCode = SQLDescribeColA(sqlStmtHandle, i, colName, 255,     &colNameLen, &dataType, &columnSize, &numDecimalDigits, &allowsNullValues);
        retArray[i][0] = dataType;
        retArray[i][1] = *colName;
    }
}
Cœur
  • 37,241
  • 25
  • 195
  • 267
  • 3
    You don't even have a `return` statement in your function – AndyG Jul 14 '17 at 13:38
  • Don't tell us you got an error without telling us what it is. Also, maybe think about your code for an extra minute or so before posting it, to realise the obvious mistake: one cannot deduce the return type if nothing is ever returned... Also, it helps to explain _what_ you're trying to do, rather than just dumping code and assuming we'll figure it out. These are probably just a few of the problems I could point out with this question. Please read [How to Ask](https://stackoverflow.com/help/how-to-ask). – underscore_d Jul 14 '17 at 14:04

1 Answers1

0

Compiler is unable to deduce the return type (note that 2D array is not a double pointer, see this answer for example). Put auto instead of auto**, add a return statement and it should work.

Miljen Mikic
  • 14,765
  • 8
  • 58
  • 66