#include <stdio.h>

int main ( int argc, char* argv [ ] )
{
int value1 = 10;
int value2 = 5;
printf ( "\n The sum is :%d", value1 | value2 );

}
This is the answer asked by some one to add two numbers
with out using arithmetic operator?Yes this answer is write
it given out put as 15.But how?????
what is need of following line?
int main ( int argc, char* argv [ ] )
how it work?what is the meaning for this line?
please explain me.Advance thanks

Answer Posted / rahul pradhan

In the printf statement, since the expression uses OR (|),
answer is correct.. 10 and 5 will be converted to its
binary equivalent.
10 = 1010
5 = 0101

10 | 5 1010
0101 gives 1111 which is 15....

Also main function takes only two arguments which
are "argc" and "argv".. thus the arguments are
mentioned...even if u just write main() without arguments,
no problem..

Is This Answer Correct ?    4 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

illustrate the use of address operator and dereferencing operator with the help of a program guys plzzz help for this question

1822


Write a program for finding factorial of a number.

836


What is structure in c definition?

783


What are file streams?

764


How is a structure member accessed?

798


What is the concatenation operator?

805


What is queue in c?

744


Differentiate between full, complete & perfect binary trees.

850


4. main() { int c=- -2; printf("c=%d",c); }

1556


What's the total generic pointer type?

801


What is null pointer constant?

771


while initialization of array why we use a[][2] why not a[2][]...?

2079


What are structures and unions? State differencves between them.

841


In c language can we compile a program without main() function?

815


Explain how can you tell whether two strings are the same?

791