vignesh


{ City } chenna
< Country > india
* Profession * student
User No # 18021
Total Questions Posted # 0
Total Answers Posted # 88

Total Answers Posted for My Questions # 0
Total Views for My Questions # 0

Users Marked my Answers as Correct # 974
Users Marked my Answers as Wrong # 508
Answers / { vignesh }

Question { 3798 }

User define function contain thier own address or not.


Answer

every instruction has it's own address , so only we have got program counters and stack pointers in micro processors, the main use of program counter (computer register) is to point to the next instuction that should be exceuted by the computer from booting till u shut down the system...........

so definetly user define functions and all the functions we have should have a address , that's why , after the operation gets over , it is returning to the main stream..... (using that functional address)

Is This Answer Correct ?    2 Yes 0 No

Question { 13376 }

Write a program for the following series?

1
121
12321
1234321
123454321
12345654321
1234567654321
123456787654321
12345678987654321
1234567890987654321
123456789010987654321
12345678901210987654321
1234567890123210987654321
.........1234321............
..........123454321............
..........12345654321............
7
8
9
0
1
Pls............?


Answer

#include
#include
void main()
{
int i,j,k,a,n,s,p;
clrscr();
printf("enter the no. of lines :");
scanf("%d",&n);
a=n;
j=1;
for(i=1;i<=n;i++)
{
for(k=1;k<=(a-1);k++)
printf(" ");
a--;
for(k=1,p=1;k<=(i-1);)
{
if(!((k%10)^0))
p=0;
printf(%d",p);
k++; p++;
}
if(!((i%10)^0)
j=0;
printf("%d",j);
j++;
s=--p;
if(i>10)
{
for(;s>=0;s--)
printf("%d",s);
s=i-(p+1)-1;
}
for(;s>0;s--)
printf("%d",s);
printf("\n");
}
getch();
}


thank u , hope this works

Is This Answer Correct ?    9 Yes 4 No


Question { 4590 }

Why is conio.h not required when we save a file as .c and
use clrscr() or getch() ?


Answer

not only conio.h , also stdio.h we dont need while saving a
C program with the extension '.c'... but in recent turbo C
or borland C compilers only it's allowing , it may be to
reduce the time of typing these files to include rather
getting automatically included.....

and even we can type main() instead of void main() , it is
accepting with the warning.............


thank u

Is This Answer Correct ?    5 Yes 3 No

Question { 13942 }

How to add two numbers with using function?


Answer

this has been demonstrated by a simple program.......

in C we ourselves can write a function for addition and
include wherver we want to add numbers.....

1) first write the function definition for the function u
are gonna write for addition....in a new file

int addition_arthmetic(int a, int b)
{
return(a+b);
}
2) dont run or compile this , directly save this file in .c
extension.. let us say "add.c".

3) then open a new file and write the program for addition
by getting the 2 i/p from the user...

#inclue
#include
#include "add.c" // we are including tthe file add.c"

void main()
{
int a,b,c;
printf("enter the values for a&b");
scanf("%d%d",&a,&b);
c=addition_arthmetic(a,b);// we call the function defined in
add.c
printf("\n\n the added value of a&b is :%d",c);
getch();
}

thank u

Is This Answer Correct ?    13 Yes 24 No

Question { Google, 13642 }

array contains zeros and ones as elements.we need to bring
zeros one side and one other side in single parse.
ex:a[]={0,0,1,0,1,1,0,0}
o/p={0,0,0,0,0,1,1,1}


Answer

#include
#include
void main()
{
int *pointer,*pointer2,n;
printf("enter the no. of elements:");
scanf("%d",&n);
pointer=(int*)malloc(n*sizeof(n));
pointer2=(int*)malloc(n*sizeof(n));
for(int k=0,i=0,j=n-1;k {
scanf("%d",(pointer+k));
if(*(pointer+k))
{
*(pointer2+(j))=*(pointer+k);
j--;
}
else
{
*(pointer2+i)=*(pointer+k);
i++;
}
}
for(i=0;i printf("%d ",*(pointer2+i));
getch();
}


thaank u

Is This Answer Correct ?    6 Yes 2 No

Question { Google, 13642 }

array contains zeros and ones as elements.we need to bring
zeros one side and one other side in single parse.
ex:a[]={0,0,1,0,1,1,0,0}
o/p={0,0,0,0,0,1,1,1}


Answer

good morning sir,

in ur above program , u said u took then length as 8 and
then allocated ur memory using DMA... but ur way of
allocation find to be wrong sir.... as you allocated

int *ptr=(int*)malloc(sizeof(8));

the above statement will allocate only 2 bytes for u....
since you have given 8 inside sizeof operator.. this will
tell the compiler allocate 2 bytes of memory .. ur
instruction must be :

int *ptr=(int*)malloc(8*sizeof(int));

so, then it will allocate 8*2 bytes of memory sir.....

so only in my program i have given n*sizeof(int) , where
'n' can be any value that user gives........


thank u

Is This Answer Correct ?    5 Yes 0 No

Question { TCS, 29194 }

main is a predefined or user define function
if user defined why?
if predefined whay?


Answer

actually main function is a user defined function for the C
compiler developer.... but it is a built in or predefined
function according to the users using that compiler.... why
it is called as a predefined function because , the
prototype has already been defined in the compiler itself
we the users can't change the meaning of that unless or
until we write our own compiler , we can change the meaning
of main()......

for the main() , we don't know what is the prototype or
where the function has been called and wht excatly the
return value of it... it is built in and abstracted from the
user which is called abstraction in c++.........


thank u

Is This Answer Correct ?    64 Yes 16 No

Question { HCL, 7117 }

what is a c-language.what is do.


Answer

C is a powerfull programming middle level language stands
third from the bottom level (machine level is the bottom
level) , C is widely used mainly to write a Operating
systems, application softwares like (text pad's ,
calculators, visual basics, spread sheets etc) ,and system
programming.... even after 40 years after it's development
still 'C' is a widely used programming language in IT
industry for all it's projects.........


thank u

Is This Answer Correct ?    25 Yes 3 No

Question { Kernex Micro Systems, 9058 }

what is pointer ?


Answer

pointer is a secondary constant and a derived data type which can hold a address or point to a particular memory location (LOGICALLY) of the same data type in which pointer variable has been declared......

syntax :
(data type) *variable_name;

integer pointer can hold only integer variable address
character pointer can hold only character variable address
floating pointer can hold only float variable address


thank u

Is This Answer Correct ?    0 Yes 0 No

Question { TCS, 9158 }

totally how much header files r in c language


Answer

actually there are more than 50 header files as for as i know........


thank u

Is This Answer Correct ?    7 Yes 13 No

Question { 3366 }

Every time i run a c-code in editor,
getting some runtime error and editor is disposing,
even after reinstalling the software
what may be the problem?


Answer

mostly the run time error will come if u dont link any files
properly u may reach these run time error..... just check it
out... as for i know this can also be a reason......


thank u

Is This Answer Correct ?    4 Yes 1 No

Question { 3564 }

why division operator not work in case of float constant?


Answer

wat i think is that , when we manipulate floating point
numbers with the same or integers , the resulting should be
float implicitly ... but when we divide any number (floating
or int) the remainder will be in INTEGER only implicitly...
so as defined in compiler numbers with float , if
manipulated gives float implicitly..... but in % operator
that will be made false... that's why i think that is not
allowed!!!!!!!!!!!


thank u

Is This Answer Correct ?    1 Yes 3 No

Question { HCL, 26009 }

which header file contains main() function in c?


Answer

that header file will not be given or revealed to the user , since there are possibilites to manipulate it........ in that file....


thank u

Is This Answer Correct ?    5 Yes 18 No

Question { 4088 }

what is Structural oriented language?
give some example of this language.....?


Answer

structure oriented language means following a specific format for writing the program.... C++ is not structured oriented since we can declare the variables wherever we like before we use those ones.....
C,COBOL, FOXPRO are some of the structured oriented languages...

thank u

Is This Answer Correct ?    3 Yes 3 No

Question { 8992 }

How to swap two values using a single variable ?

condition: Not to use Array and Pointer ?


Answer

GOOD MORNING,
swapping itself means that there must be minimum 2
variables ... if there is the way for above , that one is
not called as swapping......

Is This Answer Correct ?    17 Yes 2 No

Prev    1   2    [3]   4   5   6    Next