Interview Questions

How to use bool in c?

There is no bool data type in C. In C99 standerd version, the boolean variable has been added as _Bool. Additionally, a new header stdbool.h has been added for compatibility reasons. This header allows programmers to use boolean types in the same way, as in C++ language. To use bool in C, we can use […]


How to redirect page using PHP with values?

Here is the code for simple PHP page redirect. The search engine friendly way of redirecting is the 301 redirect. 1 2 3 4 <?php Header("HTTP/1.1 301 Moved Permanently"); header( ‘Location: http://www.yoursite.com/page.html’ ) ; ?> Note that if you do not include the first Header line above, the redirect still works. But, instead of a […]


83. Predict the output or error(s) of the following c code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include "stdio.h"
aaa() {
	printf("hi");
}
 
bbb(){
	printf("hello");
}
 
ccc(){
	printf("bye");
}
 
main()
{
	int (*ptr[3])();
	ptr[0]=aaa;
	ptr[1]=bbb;
	ptr[2]=ccc;
	ptr[2]();
}