1,026 views

1 Answer

Best answer
2 2 votes

Unsigned int range =0 to 65535

Then your question is if you insert int i =-1; then what value i will printed.

See if you give the value outside the  unsigned range .Then it will give result inside the range only .

See how -1 will be represented in 16 bit architecture Simply take 2 s complement

0000 0000 0000 0001

1111 1111 1111 1110

1111 1111 1111 1111

which is 65535 largest unsigned number

similarly for value

unsigned  int i=-2                 output i=65534

unsigned int i=65536           output i=0

• selected by
Position:
Show:

Related questions

1 1 vote
2 2 answers
527
527 views
Vishnu__ asked Feb 4
527 views
#include <stdio.h>int mystery(int n) { if (n == 0) { return 0; } else if (n % 2 == 0) { return mystery(n / 2); } else { return 1 + mystery(n...
0 0 votes
1 1 answer
752
752 views
saket jaiswal asked Jan 22, 2025
752 views
code :1 #include <stdio.h int main() { char letters[] = {'A', 'B', 'C'}; for (int i = 0; i < 3; printf("%c", letters[i], i++)) { // Empty body } r...
3 3 votes
2 answers 2 answers
847
847 views
kirmada asked Jun 20, 2024
847 views
#include <stdio.h int main() { // Write C code here int i=10,*p, q, *r; p=&i; *p=15; q=&p; q=20; r=&q; *r=*p+1; printf("%d",i); return 0; }answer the output as integer ...
1 1 vote
0 0 answers
687
687 views
shivamSK asked Jun 19, 2024
687 views
#include <stdio.h void f(int (*x)(int)); int mysh(int); int (*sh)() = mysh; int main() { f(sh); sh++; for(int x=sh;x>=0;x ){ if(x){ printf("i am here"); }else{ printf("yo...