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; } 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 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; } 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 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 is the advantage of function pointer http://www.allinterview.com/showanswers/28663.html code complexcity is less what is the hexidecimal number of 4100? http://www.allinterview.com/showanswers/23038.html FA0 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. how the size of an integer is decided? - is it based on processor or http://www.allinterview.com/showanswers/32404.html compiler 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++; class foo { public: static int func(const char*&amp; p) const; }; http://www.allinterview.com/showanswers/23036.html the 2nd const used in the example is invalid because it can be used only with member functions which have a hidden argument called this. The 2nd const would be applied to this. The funct is static member function so it hasn't any this p Give a fast way to multiply a number by 7 http://www.allinterview.com/showanswers/2828.html (x<<2)-1 what is difference between array and structure? http://www.allinterview.com/showanswers/57440.html array -same data type structure -diff datatype how to estimate the disk access time? e.g. the time between read one http://www.allinterview.com/showanswers/23037.html Disks are block devices. Mean one block of data can be read at one point of time. So there is no point of time between read one byte and another byte. If intended to calculate time to read one byte, first of all we need to calculate the time