Top C Interview Questions :: ALLInterview.com http://www.allinterview.com Top C Interview Questions en-us How to reverse a string using a recursive function, without swapping http://www.allinterview.com/showanswers/16431.html /* Following code does as intended */ #include <stdio.h> #define REVERSE_STRING(X) Rstring(X, *(X), strlen(X)-1) void Rstring( char *str, char c, int index ) { if( index != 0 ) Rstring( str, *(str+(strlen(str))-index), index-1); write a program to swap Two numbers without using temp variable. http://www.allinterview.com/showanswers/56404.html void swap(int *a,int *b) { if(*a == *b) return; *a^=*b; *b^=*a; *a^=*b; } write the program for prime numbers? http://www.allinterview.com/showanswers/35346.html main() { int i,j=2,ch=0; clrscr(); printf("\nENTER ANY NUMBER"); scanf("%d",&i); while(j<=i/2) { if(i%j==0) { printf("%d IS NOT PRIME",i); What are Storage Classes in C ? http://www.allinterview.com/showanswers/220.html There are four type of storage classes in C. These are used to store variables. These are Extern, Static, Register and Auto. Auto is the default class assigned to any variable. eg. if we define int x=10; then it means auto int x=10 regis What are advantages and disadvantages of recursive calling ? http://www.allinterview.com/showanswers/229.html advantage:using recursion we can avoid unnecessary calling of functions. disadvantage:by too many recursive functions there may be confusion in the code. Write a program to compare two strings without using the strcmp() fu http://www.allinterview.com/showanswers/2868.html #include<stdio.h> int str_cmp(const char *s1, const char *s2) { unsigned int i = 0, diff; while(*(s1+i) && *(s2+i)) { diff = (*(s1+i)-*(s2+i)); if(!diff)i++; what is difference between array and structure? http://www.allinterview.com/showanswers/57440.html array -same data type structure -diff datatype what is the difference between const char *p, char const *p, const ch http://www.allinterview.com/showanswers/2869.html const char*p - p is pointer to the constant character i.e value in that address location is constact char const *p - same as above const char* const p - p is the constant pointer which points to the constant string, both value and address a what is the use of getch() function in C program.. difference b/w get http://www.allinterview.com/showanswers/60170.html getch() is for waiting the o/p screen til we enter the inputs What does extern mean in a function declaration? http://www.allinterview.com/showanswers/5030.html extern is significant only with data declarations. In function declarations, it can be used as a stylistic hint to indicate that the function's definition is probably in another source file, but there is no formal difference between what is the advantage of function pointer http://www.allinterview.com/showanswers/28663.html code complexcity is less write a C code to reverse a string using a recursive function, witho http://www.allinterview.com/showanswers/5410.html void reverse(*str) { if(*str) { reverse(str+1); putchar(*str); } } Give a fast way to multiply a number by 7 http://www.allinterview.com/showanswers/2828.html (x<<2)-1 write a program to find out number of on bits in a number? http://www.allinterview.com/showanswers/28275.html int setbit=1; //Lets start checking from first bit int numBitSet=0; //Number of bits set in the number while(setbit>0) { if(number&setbit) //bit wise and numBitSet++; setbit=setbit<<1; } give one ip, find out which contry http://www.allinterview.com/showanswers/23039.html You can use simple ASP script to lookup country code/name from any ip addresses