What is the output of this program? [code] #include<stdio.h> #inlcude<stdlib.h> int main() { int *ptr; double

Julipkq

New member
What is the output of this program?
Code:
   #include<stdio.h>
   #inlcude<stdlib.h>
   int main()
   {
       int *ptr;
       double *ptr;
       printf("%d\n",sizeof(ptr));
       return 0;	   
   }
A. 4
B. 8
C. the compiler will give the error
D. segmentaion fault
 
Answer: c
Explanation: Just see the output carefully.
Output:
[root@localhost 123hoidap]# gcc -o san san.c
san.c: In function ‘main’:
san.c:8:10: error: conflicting types for ‘ptr’
san.c:7:7: note: previous declaration of ‘ptr’ was here
[root@localhost 123hoidap]#
 

Tìm kiếm

Back
Top