| Back to Questions Page |
| |
| Question |
declare afunction pointer to int printf(char *)? |
Rank |
Answer Posted By |
|
Question Submitted By :: Guest |
| This Interview Question Asked @ HCL |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer | the function pointer to an int printf(char *) will be:
int (*ptr)(char*);
Now you can assign the function address to the pointer to a
function.
ptr = printf;  |
| Sunil Singh |
| |
| |
| Question |
What ios diff. Between %e & %f? |
Rank |
Answer Posted By |
|
Question Submitted By :: Guest |
| This Interview Question Asked @ Honeywell |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer | both %e and %f are use for Floating point format specifier.
%e- it shows the value in the Exponential(scientific way).
%f - it shows this value to normal way.
Example:
float f = 1.34f;
printf("%e - %f",f,f);
outPut:
1.34e+00- 1.34  |
| Sunil Singh |
| |
| |
| Question |
disadvantages of realloc ? |
Rank |
Answer Posted By |
|
Question Submitted By :: Vishnu948923 |
| This Interview Question Asked @ HCL |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer | Library:<stdlib.h>
define:void *realloc(void *ptr, size_t size);
it modifies the existing size of block to new size with
copies of existing data.simply it add/delete the memory of
existed pointer based on new size without changing its
contents and it returns the pointer of first location.
possible cases:
1.if size >0,ptr is not null->modify the ptr with new size
and return pointer of 1st location.
2.if size is 0,ptr is not null->it would not change the
size of pointer but delete the existing contents.
3.if size >0,ptr is null->create new ptr with that size and
return that new pointer.
4.if there is not enough space to rellocate ptr,then it
return null pointer with out changing the block of data.
case 2 and 4 are disadvantages,since orignial contents are
getting deleted and also if we trying to use null pointer
then it would crash the program.  |
| Babitha |
| |
| |
|
|
| |
| Question |
Please list all the unary and binary operators in C. |
Rank |
Answer Posted By |
|
Question Submitted By :: Rohit |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer | unary operatos are increment(++),decrement(--),minus(-)
,ampersand(&)negation(!),sizeof(),pointer referance
(*),one's complement(~).......
and binary operatos are +,*,%,/,<,>,=,AND(&&),OR
(||),assigment operator(==),inequility(>=,<=)  |
| Kuldeep Singh |
| |
| |
| Question |
Read N characters in to an array . Use functions to do all
problems and pass the address of array to function.
1. Print only the alphabets . If in upper case print in
lower case vice versa. |
Rank |
Answer Posted By |
|
Question Submitted By :: Nithya |
|
I also faced this Question!! |
© ALL Interview .com |
| Answer | #include<stdio.h>
#include<conio.h>
void fun(char *);
void main()
{
char a[50];
printf("enter the characters :");
gets(a);
fun(&a);
getch();
}
void fun(char *a)
{
char c;
for(int i=0;a[i]!='\0';i++)
{
if(a[i]>=97&&a[i]<=122)
{
c=a[i]-32;
printf("%c",c);
}
else if(a[i]>=65&&a[i]<=90)
{
c=a[i]+32;
printf("%c",c);
}
else if(a[i]==' ')
countine;
}
}  |
| Vignesh1988i |
| |
| |
|
| |
|
Back to Questions Page |