All compiler keep the size of integer the same as the size of register on a particular architecture. So the
Tag: C interview questions
C interview questions, These are very important interview questions specially for experienced as well freshers.
Q36 Is float a = 22/7 and double b = 22/7 is equal? How to compare floating point numbers?
if(a == b) may be true or may not be, that’s because of the way floating point numbers are stored.
Q34 Write a program to convert from one Endian to another.
int endian_reverse_fun(int num) { int byte0, byte1, byte2, byte3; byte0 = (num & x000000FF) >> 0 ; byte1 = (num
Q33 What is little endian and big endian? How to check a system is little endian or big endian?
Little and big endian are method of storing data in machine. Little Endian means that the lower order byte of
Q32 What is meaning of error that shows lvalue required?
An lvalue is something that can appear on the left side of an assignment, in other words something that can
Q30 When sizeof() operator works, compile time or run time?
sizeof() is a compile time operator. It works at compile time that’s why we called it operator not function. To
Q28 How to check that the stack grows up or down?
To check stack grows up or down take two local variable and check their address. If (address of variable 1
Q27 Write a C program to round numbers.
Use this statement to round numbers (int)(number < 0 ? (number – 0.5) : (number + 0.5))
Q26 Write a C program to check leap year.
#include<stdio.h> int main() { int year; printf(“Enter any year to check leap year\n”); scanf(“%d”,&year); if((year %
Q25 Write a C program to find duplicate integer in an array.
#include<stdio.h> int main() { int i, j, temp, arr[10]; printf(“Enter the number with some repeated number\n”); for(i
Q24 Write a C program to convert from decimal to binary, octal, or hex number system.
#include<stdio.h> void decimal_to_any_base(int number, int base) { int i, x, digits[1000], flag; i = 0; while(number)
Q23 Write a C program which produces its own source code as its output.
#include<stdio.h> int main() { FILE *fptr; char chr; fptr = fopen(__FILE__,”r”); do{ chr= getc(fptr); putchar(chr); } while(chr!=EOF); fclose(fptr); return 0;