int to string, char* itoa
问题 trying to get ‘sval’ to contain the string “$1” – “$500” for array indexes 0-499. in the following code, however itoa is giving me strange strings in the code below: #include<iostream> #include <stdio.h> #include <stdlib.h> using namespace std; typedef struct data_t { int ival; char *sval; } data_t; void f1(data_t **d); int main() { data_t *d; d=static_cast<data_t*>(malloc(500)); //is this even needed? d = new data_t[500]; f1(&d); } /* code for function f1 to fill in array begins */ void f1