0
How to take input of integers of array and string without knowing the size of the array?
Input 7 6 5 2 1 Output 7 6 5 2 1
2 Antworten
+ 2
with integer it can't be done, but with string it can be done because we always check for NULL, which gives us advantage to take as many input as we want without knowing the length of the input and without shooting ourselves in the leg, for strings you can use "fgets(pointer,size, stdin); and if you want a user defined length like display the amount of input the user give, you can use the memory allocation function to do that, without wasting memory
0
for integers we can use while(scan("%d ",&a)==1)