cLanguage array string question

Asked 2 years ago, Updated 2 years ago, 37 views

I can get a text message for each array element, right? It can be easily implemented as a for statement I saw several examples of text messages When I receive the text in scanf, there are a few things that are confusing.

When there is an array of str[10],

ex)

 for(i=0; i<3; i++)

   scanf("%s", str[i]); 

ex)

 scanf("%s", str);

I would appreciate it if you could explain in detail how the two examples contain and contain strings. In addition to this example, if you can receive a string differently, I would appreciate it if you could add it and explain it.

c string array

2022-09-21 11:43

1 Answers

The first array called str has a daily access to the value of one element's value.

The second is to approach the array called str and insert the input value from the first element.

And if you modify the code you used the FOR statement,

    for(i=0;i<3;i++)
    {   
        scanf("%c",&str[i]);
        getchar();   
    }

I think we need to write the code like this


2022-09-21 11:43

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.