Cisco Systems Interview Question
Software Engineer / DevelopersCountry: United States
Interview Type: Written Test
#include<stdio.h>
int main(){
FILE *fp;
char c;
fp = fopen(__FILE__,"r");
do{
c= getc(fp);
putchar(c);
}
while(c!=EOF);
fclose(fp);
return 0;
}
If the question is to print only the function name, we can make use of macro __FUNCTION__ in C.
void func()
{
printf("%s",__FUNCTION__);
}
The are called as "Quine". You can search on Google/wikipedia for Quine computing.
- Aditya November 20, 2012