SURESHKUMAR.NET FORUMS
Registered Member Login:
Not a member? Register today!



Welcome to the SURESHKUMAR.NET FORUMS.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.




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.

How do you write a program which

        

Reply
 
LinkBack Thread Tools Display Modes
Old 14-06-08, 01:29 AM   #1 (permalink)
Senior Member
 
Join Date: Apr 2008
Posts: 13,341
Thanks: 0
Thanked 26 Times in 26 Posts
Rep Power: 137 ShivaniX is a jewel in the rough ShivaniX is a jewel in the rough ShivaniX is a jewel in the rough
How do you write a program which

How do you write a program which produces its own source code as
output?

ShivaniX is offline Offline   Reply With Quote
Old 20-06-08, 02:18 PM   #2 (permalink)
Junior Member
 
Join Date: Jun 2008
Age: 24
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 2 chaithu.shd is on a distinguished road
Re: How do you write a program which

what is the answer for the above program
chaithu.shd is offline Offline   Reply With Quote
Old 26-06-08, 02:50 PM   #3 (permalink)
Junior Member
 
Join Date: Apr 2008
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 2 mohanl is on a distinguished road
Post Re: How do you write a program which

//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.
mohanl is offline Offline   Reply With Quote
Old 29-10-08, 01:00 PM   #4 (permalink)
Junior Member
 
Join Date: Oct 2008
Age: 26
Posts: 14
Thanks: 2
Thanked 1 Time in 1 Post
Rep Power: 2 retheeshsoman is on a distinguished road
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);
}
~
retheeshsoman is offline Offline   Reply With Quote
Old 29-10-08, 04:04 PM   #5 (permalink)
Junior Member
 
Join Date: Jul 2008
Age: 30
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 2 naresh80 is on a distinguished road
Thumbs down Re: How do you write a program which

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
naresh80 is offline Offline   Reply With Quote
Reply

Tags
c language , interview questions , program , write


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On


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


All times are GMT +6.5. The time now is 12:31 AM.

More Interview Questions Here...

Content Relevant URLs by vBSEO 3.3.2