c - How to make flexible array that based on the input -


#include<stdio.h> #include<ctype.h> int main() {     int i=0;     char in[100],mychar;     fgets(in,sizeof(in),stdin);     while (in[i]) {         mychar=in[i];         putchar (toupper(mychar));         i++;     }     return 0; } 


simple program used change string of characters uppercase letters. question declare array in[100], how can make array number follow input? mean if type 1201 characters , program make have array follows input in[1201].

you can see c++ vector does: can malloc length of l @ fist, every time getch(), should decide if expand l 2*l (or l + 100 saving spaces)


Comments

Popular posts from this blog

javascript - How to name a jQuery function to make a browser's back button work? -

python - Django-easy-pdf: xhtml2pdf reporting reportlab 2.2+ is required, but 3.0 installed -

collision detection - C++ library for mesh to mesh intersection: what is available? -