Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


#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

Answers were Sorted based on User's Feedback



#include <stdio.h> int main ( int argc, char* argv [ ] ) { int value1 = 10; int value2..

Answer / deepak

binary value of 10 = 1010
binary value of 5 = 0101

so if u do bitwise OR. u will get 1111, which is the binary
value of 15. Note: This will not work for all the case:
For eg, value1 = 5 and value2 = 5 will not give u 10.
Instead the printf will print 5 only.

Is This Answer Correct ?    16 Yes 1 No

#include <stdio.h> int main ( int argc, char* argv [ ] ) { int value1 = 10; int value2..

Answer / 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

#include <stdio.h> int main ( int argc, char* argv [ ] ) { int value1 = 10; int value2..

Answer / sivakumar

the argc and argv are mentioned in the main as arguments
those are used for the purpose of command line statements.
if we mentioned the main like (argc,argb[]),then that
program can work as command line program. like dos
functions(type,copy....).
Then at that time argc contains count of parameters and argv
contains list of arguments.
eg:-
show_sum 10 20 30
then argc contain value 3 and argv containe list{10,20,30).
ok.

Is This Answer Correct ?    3 Yes 0 No

#include <stdio.h> int main ( int argc, char* argv [ ] ) { int value1 = 10; int value2..

Answer / manojkumar

hello deepak sir
ur answer is exactly write.Thank you sir.
But i want to know the meaning or this and how it work?
will u please explain me?
thanks.

what is need of following line?
int main ( int argc, char* argv [ ] )

Is This Answer Correct ?    1 Yes 0 No

#include <stdio.h> int main ( int argc, char* argv [ ] ) { int value1 = 10; int value2..

Answer / vijay

argc means argument count
argv means argument vector
argc contains the no of arguments and argv[] contains the
argument values

Is This Answer Correct ?    1 Yes 0 No

#include <stdio.h> int main ( int argc, char* argv [ ] ) { int value1 = 10; int value2..

Answer / manojkumar

ok
thank u sir

Is This Answer Correct ?    0 Yes 0 No

#include <stdio.h> int main ( int argc, char* argv [ ] ) { int value1 = 10; int value2..

Answer / valli

Thank u so much..

Is This Answer Correct ?    0 Yes 0 No

#include <stdio.h> int main ( int argc, char* argv [ ] ) { int value1 = 10; int value2..

Answer / valli

why is it taking those two arguments?what is the need of
them?why we are taking integer and character arguments???

Is This Answer Correct ?    0 Yes 1 No

#include <stdio.h> int main ( int argc, char* argv [ ] ) { int value1 = 10; int value2..

Answer / harish

i think wat rahul explained is true...but one correction to
be made is that main takes three arguments.... i dnt exactly
remember wat its called......

Is This Answer Correct ?    0 Yes 3 No

Post New Answer

More C Interview Questions

Distinguish between actual and formal arguments.

0 Answers  


hello freinds next week my interview in reliance,nybody has an idea about it intervew questions..so tell

0 Answers   Reliance,


what is the difference between procedure oriented and object oriented progaming language

1 Answers  


What is the newline escape sequence?

0 Answers  


logic for x=y^n

1 Answers   Delphi,


What is #define used for in c?

0 Answers  


which is the best site or book for learning C...and i need the content for C..how to get the good programming skills....? can plz suggest me....

2 Answers  


Can anyone help me with this please? Need to print the below values.. Thanks 1 1 2 1 2 3 1 2 3 4

3 Answers  


how to swap 2 numbers within a single statement?

4 Answers  


I need a help with a program: Write a C program that uses data input in determining the whole of points A and a whole of circles B. Find two points in A so that the line which passes through them, cut through the maximum number of circles.

0 Answers   TCS,


write a program to copy the string using switch case?

0 Answers   Mind Tree,


Write an algorithm for a program that receives an integer as input and outputs the product of of its digits. E.g. 1234 = 24, 705 = 0

4 Answers  


Categories