True or false: If you continuously increment a variable, it
will become negative?
1) True
2) False
3) It depends on the variable type
Answers were Sorted based on User's Feedback
Answer / k sriharsha
It will not become negative if we use unsign data type.
| Is This Answer Correct ? | 19 Yes | 3 No |
Answer / a programmer
It depends upon the variable type. Ex: if the variable is
declared as unsigned int then if we increment the value will
not become negative.
| Is This Answer Correct ? | 10 Yes | 2 No |
Answer / sachin
after a limit of the variable ,it becomes -ve.
for ex:-
#include<stdio.h>
void main()
int i;
if(i<=32767)
{
printf("%d",i);
i++;
}
}after printing 1 to 32767,it tries to become 32768 which is
outside the limit,so it goes to the other side and become
-32768 and loops become indefinite.
| Is This Answer Correct ? | 3 Yes | 0 No |
Explain what happens if you free a pointer twice?
What is a ternary operator in c?
What is the main difference between calloc () and malloc ()?
What is bubble sort technique in c?
main() { float f1=10.5; double db1=10.5 if(f1==db1) printf("a"); else printf("b") }
what is the differnce between AF_INET and PF_INET?
5 Answers Systems Plus, Wipro,
Is it better to use malloc() or calloc()?
What is a buffer in c?
Give a fast way to multiply a number by 7
15 Answers Accenture, Aricent, Microsoft,
Explain how can I convert a number to a string?
how to TOGGLE Nth bit of variable in a MACRO
Is c still relevant?