vadivel t


{ City } hyderabad
< Country > india
* Profession * software engineer
User No # 45606
Total Questions Posted # 1
Total Answers Posted # 55

Total Answers Posted for My Questions # 1
Total Views for My Questions # 2839

Users Marked my Answers as Correct # 281
Users Marked my Answers as Wrong # 166
Answers / { vadivel t }

Question { 3519 }

what does ‘segmentation violation’ mean?


Answer

Segmentation voilation occurs when we are trying to access
or modify the data in the location, which is resticted to
access. This problem can occur when u r trying to write
data in read only memory or when u r trying to overwrite
the OS files.

Is This Answer Correct ?    2 Yes 0 No

Question { 3949 }

How do you initialize function pointers? Give an example?


Answer

Initialisation can be done in the following way.

func(int a,int b);
*pfunc(int a, int b);
main()
{

/*here the starting address of the function can be assigned
to a function pointer of the same type*/
pfunc = func;
....
....
....
}
func(int a, int b)
{
....
....
....
}

Is This Answer Correct ?    1 Yes 0 No


Question { 3949 }

How do you initialize function pointers? Give an example?


Answer

Sorry the above function pointer declaration should be like
this

(*pfunc)(int, int);

Is This Answer Correct ?    0 Yes 0 No

Question { 3425 }

where can function pointers be used?


Answer

Mostly fuction pointers are used in the situation, where
the callback fuctions are needed...

--
VEL

Is This Answer Correct ?    1 Yes 0 No

Question { 5638 }

what are bitwise shift operators?


Answer

To Rina answer:

&, |, ^ are not bit wise shift operator.
just they are unary bit wise operators thats it. Bitwise
shift operators are only >> and <<.

--
VEL

Is This Answer Correct ?    2 Yes 0 No

Question { Qualcomm, 17299 }

Toggle nth bit in a given integer - num


Answer

#include

int main()
{
int no, bit;
printf("ENTER THE NO AND BIT NO, TO TOGGLE: ");
scanf("%d %d", &
no, &bit);
if(no & (0x1 << bit-1))
{
no = no^(0x1 << bit - 1);
}
else
{
no = no | (0x1 << bit - 1);
}
printf("%d \n", no);

_getch();
}

Is This Answer Correct ?    3 Yes 3 No

Question { HCL, 5138 }

What is volatile in c language?


Answer

Volatile is one of the tpye qualifier in c. This qualifier
is used with the variable when the variable value is
expected to be changed by an external event(eg: system
clock, interrupt).

Is This Answer Correct ?    1 Yes 0 No

Question { Wipro, 14694 }

write a c program to print the values in words
eg:- 143 written it has (one hundred and forty three)&
104, 114 are also written words


Answer

In the code above, which i have answered has unwanted
assignment to No ie ., no = 999, and i, j and all pls
neglect those parameters.. just i hav written in hurry...
Dont mind

Is This Answer Correct ?    1 Yes 2 No

Question { Wipro, 14694 }

write a c program to print the values in words
eg:- 143 written it has (one hundred and forty three)&
104, 114 are also written words


Answer

Hi,

I have written code for only 3 digit numbers(u may not get
exact result for 100, 200, 113 etc ). This is just for an
idea from which u can build ur logic.
I accept... This code can be optimised.

Dont think that code is too lengthy... cos we hav to hav
limited if, else if or switch for this requirement.

Apply ur logic for 123455677 kind of nos.

#include
/*Convert no to word... only for 3 digit nos*/
void ConvertToWord(int length);
char* Tens(int *a);
int Temp[10], Length = 0;

int main()
{
int No = 999, DupNo, i, j;
printf("ENTER THE THREE DIGIT NO: ");
scanf("%d", &No);
DupNo = No;
while(DupNo != 0)
{
Temp[Length] = DupNo % 10;
DupNo = DupNo / 10;
Length++;
}
printf("%d - ", No);
ConvertToWord(Length);
_getch();
}


void ConvertToWord(int Length)
{
while(Length != 0)
{
switch(Length)
{
case 0:
break;
case 1:
switch(Temp[Length - 1])
{
case 0:
break;
case 1:
printf("ONE ");
break;
case 2:
printf("TWO ");
break;
case 3:
printf("THREE ");
break;
case 4:
printf("FOUR ");
break;
case 5:
printf("FIVE ");
break;
case 6:
printf("SIX ");
break;
case 7:
printf("SEVEN ");
break;
case 8:
printf("EIGHT ");
break;
case 9:
printf("NINE ");
break;
}
Length--;
break;

case 2:
switch(Temp[Length -1])
{
case 0:
break;
case 1:
break;
case 2:
printf("TWENTY ");
break;
case 3:
printf("THIRTY ");
break;
case 4:
printf("FORTY ");
break;
case 5:
printf("FIFTY ");
break;
case 6:
printf("SIXTY ");
break;
case 7:
printf("SEVENTY ");
break;
case 8:
printf("EIGHTY ");
break;
case 9:
printf("NINETY ");
break;
}
Length--;
break;

case 3:
printf("%s HUNDRED AND ", Tens(&Temp[--
Length]));
break;
}
}

}

char* Tens(int *a)
{
char *ch;
switch(*a)
{
case 0:
ch = "ZERO";
break;
case 1:
ch = "ONE";
break;
case 2:
ch = "TWO";
break;
case 3:
ch = "THREE";
break;
case 4:
ch = "FOUR";
break;
case 5:
ch = "FIVE";
break;
case 6:
ch = "SIX";
break;
case 7:
ch = "SEVEN";
break;
case 8:
ch = "EIGHT";
break;
case 9:
ch = "NINE";
break;
}
return ch;
}

Is This Answer Correct ?    3 Yes 7 No

Question { Bosch, 28345 }

write a c program to change only the 3rd bit of the
particular number such that other bits are not affected..
if bitnum=10(say.. it can be any no..


Answer

assume int holds 4bytes...

For ex:

#include
int main()
{
int i = 16;
if(i & 0x04)
{
/*3rd bit is set to 1- so reset it to 0 - other bits will
not be disturbed*/
i = i & 0xFFFFFFFFB;
printf("IN IF \n");
}
else
{
/*3rd bit is set to 0- So set it to 1 - other bits will
not be disturbed*/
i = i | 0x00000004;
}
printf("%d", i);
_getch();
return 0;
}

Is This Answer Correct ?    4 Yes 1 No

Question { 4665 }

to get a line of text and count the number of vowels in it


Answer

#include
#include

int main()
{
char ptr[100]= "She lives in NEWYORK";
printf("VOWELS EXIST %d TIME(S)\n",CountVow(ptr));
getch();
}

int CountVow(char *ptr)
{
int count = 0;
while(*ptr != '\0')
{
if((*ptr == 'a') || (*ptr == 'A') || (*ptr == 'e') ||
(*ptr == 'E') || (*ptr == 'i') ||
(*ptr == 'I') || (*ptr == 'o') || (*ptr == 'O') ||
(*ptr == 'u') || (*ptr == 'U'))
{
count++;
}
ptr++;
}
return count;
}

Is This Answer Correct ?    2 Yes 3 No

Question { TCS, 28876 }

what is the full form of c language


Answer

There is no full form for C language. The name "C" had come
because the prior language to "C" is "B" and was developed
in AT&T lab.

Is This Answer Correct ?    63 Yes 23 No

Question { 11701 }


Explain Linker and Loader


Answer

Linker is a stage before loader. Linker is a person who is
responsible for linking the different object file and the
outcome will be a executable file. Loader is a person who
reads the content of the executable file and place it into
memory. This code shall be executed when the operating
system control is coming to the loaded program.

Is This Answer Correct ?    9 Yes 7 No

Question { 4928 }

WAP that prints the number from 1 to 100. but for multiplies of
three print "XXX" instead of the number and for the multiplies of
five print "YYY" . for number which are multiplies of both three
and five print "ZZZ"


Answer

#include

main()
{
int i;
for(i = 1 ; i<=100; i++)
{
if((i%5 == 0) && (i%3 == 0))
printf("ZZZ \n");

else if(i%3 == 0)
printf("XXX \n");

else if(i%5 == 0)
printf("YYY \n");

else
printf("%d \n",i);
}
_getch();
}

Is This Answer Correct ?    2 Yes 0 No

Question { 3648 }

Hai friends im a i year student. i want to develop my
knowledge in the field of TSR in c. How I'm Improve ?


Answer

Hi,

Terminate and stay resident(TSR)is a old style of
programming concept in c. This is used to have a
multitasking in DOS kind of envirnment and it can be used
to develop .COM application in C language.

TSR can be used to write small kind of application(max
64KB) which can be attached to a main memory of the system
and will be called whenever needed.

If u want to explore more go through with Kanethkar TSR
programming book.

Is This Answer Correct ?    0 Yes 0 No

Prev    1   2    [3]   4    Next