diff options
| author | ven <vendethiel@hotmail.fr> | 2015-10-04 21:23:34 +0200 | 
|---|---|---|
| committer | ven <vendethiel@hotmail.fr> | 2015-10-04 21:23:34 +0200 | 
| commit | 2a337bef67c44db674b13bfcc9a94e4f3429bfa9 (patch) | |
| tree | acddedd1264f61772352a9616e94dc364f7ade0f /c.html.markdown | |
| parent | 36553a181aa3d9f1a637b141f591f2ccc7c43ade (diff) | |
| parent | 2e987df42225e6bdf824584058467aaffc73fb49 (diff) | |
Merge pull request #1329 from thePsguy/patch-2
{c}Variable size array, user size input added.
Diffstat (limited to 'c.html.markdown')
| -rw-r--r-- | c.html.markdown | 4 | 
1 files changed, 3 insertions, 1 deletions
| diff --git a/c.html.markdown b/c.html.markdown index 8e631de4..db2ac930 100644 --- a/c.html.markdown +++ b/c.html.markdown @@ -130,7 +130,9 @@ int main(void) {    // can be declared as well. The size of such an array need not be a compile    // time constant:    printf("Enter the array size: "); // ask the user for an array size -  char buf[0x100]; +  int size; +  fscanf(stdin, "%d", &size); +  char buf[size];    fgets(buf, sizeof buf, stdin);    // strtoul parses a string to an unsigned integer | 
