What is the output of this program? [code] #include<stdio.h> #include<sys/socket.h> int main() { int ret; ret

Thanh Thảo

New member
What is the output of this program?
Code:
   #include<stdio.h>
   #include<sys/socket.h>
   int main()
   { 
       int ret;
       ret = shutdown(0,0);
       printf("%d\n",ret);
       return 0;
   }
A. 0
B. -1
C. can not be determined
D. none of the mentioned
 
Answer: b
Explanation: The shutdown() is used to close a socket and the first argument in shutdown() is socket.
Output:
[root@localhost 123hoidap]# gcc -o san san.c
[root@localhost 123hoidap]# ./san
-1
[root@localhost 123hoidap]#
 

Tìm kiếm

Back
Top