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

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

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