0
c gets eror question is i the message part
#include<stdio.h> // Guys ı want to display that code with using get as i wrote #include<string.h> int main(){ char x[100]; char y[100]; char z[100]; char x1[100]; char y1[100]; char z1[100]; printf("please input your 'name','surname'and'occupation'.\n" ); scanf("%s%s",&x,&y); gets(z); // it doesnt get the z parameter while using get what is the reason ? strcat(x,x1); strcat(y,y1); strcat(z,z1); printf("name %s\n",x); printf("surname %s\n",y); printf("occupation %s\n",z); }
1 ответ
+ 4
Because `gets` function does not care about buffer size. Use `fgets` or `scanf` instead.
https://www.geeksforgeeks.org/gets-is-risky-to-use/
https://stackoverflow.com/questions/1694036/why-is-the-gets-function-so-dangerous-that-it-should-not-be-used