How can I write an Array in size of char-Pointer in C language [closed]
Want to improve this question? Add details and clarify the problem by editing this post.
开发者_StackOverflow中文版Closed 1 hour ago.
Improve this questionI want to get the output like this. The Output is alway like String but it is the result of the Characters. The even Numbers staying like 0 and not changed but the odd Numbers are '+' or '-' and the results are alwas as a chanin Numbers. It can also be Negative Number.Like examples.
I have tried to use calloc and malloc but I don't know how to write it correctly.
2 # include < stdio .h > // fuer printf () 3 # include < stdlib .h > // fuer free 4 5 char * preccalc { char * term [] , int size ); // Description of the Funktion 6 7 int main (int carg , const char ** varg ){ 8 if (( carg ==0)||( carg % 2 != 0)) // even Parameter Number >0 ? 9 return -1; // ( Parameter started with program names ) 10 char * result = preccalc (& varg [1] , carg -1); 11 printf (" Ergebnis :"% s ".\ n",result ); // output 12 free ( result ); 13 return 0; // 0 means it is okay 14 } 15 16 // Ihr Code aus calc.c ab hier
精彩评论