![]() |
|
| C C Interview Questions asked in various Interviews. Professionals are invited to share Answers for these C Interview Questions. C Interview Questions with answers, Experiences, Career Advices, Tips and more. |
![]() |
| LinkBack | Thread Tools | Display Modes |
| | #1 (permalink) |
| Senior Member Join Date: Apr 2008
Posts: 13,341
Thanks: 0
Thanked 26 Times in 26 Posts
Rep Power: 137 | How do you write a program which How do you write a program which produces its own source code as output? |
| | |
| | #2 (permalink) |
| Junior Member Join Date: Jun 2008 Age: 24
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 2 | Re: How do you write a program which what is the answer for the above program |
| | |
| | #3 (permalink) |
| Junior Member Join Date: Apr 2008
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 2 | //This is a program it prints output as source code of the same program //File Name:p1.c #include int main() { char same[500]; int i; FILE *fp; fp=fopen("itself.c","r"); if(fp==NULL) { puts("File Opening Error"); return(1); } i=0; while ( !feof(fp) ) { fscanf(fp,"%c",&same[i]); i++; } puts(same); fclose(fp); return(0); } Compile and Run the above program.You will get output. |
| | |
| | #4 (permalink) |
| Junior Member Join Date: Oct 2008 Age: 26
Posts: 14
Thanks: 2
Thanked 1 Time in 1 Post
Rep Power: 2 | Re: How do you write a program which Dear Sivani, Try It will Work, char *s="char *s=%c%s%c;int main(){printf(s,34,s,34)}"; int main(){ printf(s,34,s,34); } ~ |
| | |
| | #5 (permalink) |
| Junior Member Join Date: Jul 2008 Age: 30
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 2 | He He He Do you think the output will be the same as program source code. Pls compile and run it. I got this problem at Trainings IT professioanls and freshers looking for IT jobs and have been trying to get the answer since long. Regards |
| | |
![]() |
| Tags |
| c language , interview questions , program , write |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| WRITE A PROGRAM TO R | ShivaniX | C | 2 | 13-07-09 06:39 PM |
| Write a program that swaps two integers without using = sigh | karan_vampire | JAVA Technologies | 2 | 17-07-08 12:17 PM |
| write a program to remove comment lines and blank lines | ShivaniX | C | 0 | 11-06-08 07:30 PM |
| Write a C program on Centralized OLTP | ShivaniX | C | 0 | 25-05-08 03:50 AM |
| Write the program for displaying the | ShivaniX | C | 0 | 25-05-08 03:43 AM |
| More Interview Questions Here... |